Block xdg-open Specific URLs in Chrome Linux

Posted on Jun 8, 2025

Want to stop Chrome Linux from opening weird stuff like bytedance:// or whatsapp:// links? Here’s a quick and easy way to block specific URL schemes using Chrome’s policy system.

🛠️ Step-by-Step Guide

1. Create the Policy Directory (if it doesn’t exist)

Make sure the following path exists:

sudo mkdir -p /etc/opt/chrome/policies/managed

2. Create the Policy File

Create a new JSON file named blocklist.json:

sudo nano /etc/opt/chrome/policies/managed/blocklist.json

Paste the following inside:

{
    "URLBlocklist": [
        "bytedance://*",
        "whatsapp://*"
    ]
}

This tells Chrome to block any link that starts with bytedance://. You can add more URLs if you want — just separate them with commas.

3. Restart Chrome

Close Chrome completely and start it again. The blocked URLs should now be disabled. If you try clicking a bytedance:// link, nothing will happen — just like magic. 🧙

🧪 Test It Out

Try visiting a site or link that uses the blocked URL scheme. Chrome should now prevent it from being handled or passed to xdg-open.


📚 References