How to prevent popping-up xdg-open dialogue from Ubuntu chrome while opening specific link? How to prevent popping-up xdg-open dialogue from Ubuntu chrome while opening specific link? selenium selenium

How to prevent popping-up xdg-open dialogue from Ubuntu chrome while opening specific link?


This solution works on Google Chrome 84.0.4147.89, for specific types of xdg links. For example, if the link in question is whatsapp://someurl, you can use:

sudo mkdir -p /etc/opt/chrome/policies/managed/ && echo '{ "URLWhitelist": ["whatsapp://*"] }' |sudo tee /etc/opt/chrome/policies/managed/whitelist.json


Here is the official documentation (https://support.google.com/chrome/a/answer/7532419) on how to do it.

@Eyal's answer is pretty close. Instead you should set the URLBlocklist field.

sudo mkdir -p /etc/opt/chrome/policies/managedcd /etc/opt/chrome/policies/managedjq -n '.URLBlocklist=["whatsapp://*"]' | sudo tee blocklist.json


This worked out for me...go to .local/share/applications/create a file .. say whatsapp.desktop with the following info

[Desktop Entry]Type=ApplicationName=Whatsapp Scheme HandlerExec=/opt/google/chrome/google-chrome %uStartupNotify=falseMimeType=x-scheme-handler/whatsapp;

then registry the scheme handler with the following command

     xdg-mime default whatsapp.desktop x-scheme-handler/whatsapp