Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to join a whatsapp group using desktop web whatsapp (chrome, ubuntu). When I click on Join Group, It shows dialogue below.I want to remove this dialogue forever from chrome. I can join the group by clicking again on join the group after dismissing the xdg-open dialogue.

I tried Reset chrome protocol_handler chrome with no luck.

I also tried to dismiss the dialogue using python selenium with no luck using below code.

               try:

                    WebDriverWait(browser, 3).until(EC.alert_is_present(),
                           'Timed out waiting for PA creation ' +
                           'confirmation popup to appear.')
                    #if it doe
                    alert = browser.switch_to.alert()
                    alert.accept()
                    print "alert accepted"
                except TimeoutException:
                    print "no alert"
                    pass

Is there a way to dismiss the dialogue using python selenium or using some configuration file changes in chrome installation ?

enter image description here

like image 989
iamabhaykmr Avatar asked Aug 23 '18 12:08

iamabhaykmr


People also ask

What is Xdg-open Ubuntu?

DESCRIPTION. xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type.

What opens Xdg?

xdg-open command in the Linux system is used to open a file or URL in the user's preferred application. The URL will be opened in the user's preferred web browser if a URL is provided. The file will be opened in the preferred application for files of that type if a file is provided.


1 Answers

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/managed
cd /etc/opt/chrome/policies/managed
jq -n '.URLBlocklist=["whatsapp://*"]' | sudo tee blocklist.json
like image 184
wizawu Avatar answered Sep 22 '22 10:09

wizawu