8

There is still no way to install a native Linux application for whatsapp, so I always use whatsapp's webapp with my daily browser (chromium based brave-browser).

Everything works [mostly] fine, except when I need to click on a whatsapp link in a web site, that is supposed to open a conversation with a certain new cell phone number. Here's an example on BOSE's site when you click in the button "message us".

When I click on a button like that one, I get redirected to api.whatsapp.com and then I get a popup prompt on my browser asking:

Open xdg-open?
https://api.whatsapp.com wants to open this application.

If I proceed, nothing happens.

I would expect to have a new whatsapp web tab opened to be able to message the new contact.

I have tried to use xdg-mime but I can't understand how to use it.

chronos00
  • 771
  • 1
    I found a snap https://snapcraft.io/whatsdesk and https://github.com/eneshecan/whatsapp-for-linux/releases – nobody Dec 31 '21 at 22:12

3 Answers3

17

You should be able to avoid the xdg popup by blocking JavaScript for api.whatsapp.com through site permissions. Since the webpage has a "continue to chat" link that redirects to web.whatsapp.com, assuming I understood the problem correctly, that link is the solution.

Martin
  • 284
  • Wow, that was surprisingly simple. After I blocked JavaScript, the popup was not shown after clicking on "message us". Instead, I was able to click on "continue to chat" in the following page, and web.whatsapp.com was loaded with the appropriate chat opened. Thank you! – chronos00 Jan 01 '22 at 23:12
  • 4
    Here are the steps to do this. Look for the three dots icon next to your avatar in the upper right corner, click on it and choose the settings option. On the page that opens in the left menu, click Privacy and security. In the options that appear in the center, click Site Settings. At the bottom of the contents section, click Javascript. At the bottom, in the Customized behaviors section, click the add button for the Not allowed to use javascript option and type in the text box api.whatsapp.com and you're done. – Mike Aug 10 '22 at 16:08
  • 3
    You don't need to block JavaScript. You can right-click on the link and pick open in a new tab or window. – jcubic Aug 20 '22 at 16:24
  • That's brilliant. It worked, many thanks Martin! I didn't know I can block JavaScript for websites. – Onkeltem Aug 17 '23 at 10:04
9

this worked for me, just register chrome as whatsapp handler, no need to disable javascript

xdg-mime default google-chrome.desktop 'x-scheme-handler/whatsapp'
francarl
  • 191
0

Just hit cancel on the XDG-open prompt.

Then there is javascript on the big green button that triggers the XDG-open stuff again if you click it. You can disable the javascript as other answers suggest, but I prefer to right-click on the button and copy the link or "open in new tab".

You'll get a new web.whatsapp.com tab, you can close the old one that now says: "web.whatsapp is open in other tab".

This is a workaround, as closing the old window might not be desirable (you lose drafts).

rew
  • 434
  • I was trying to avoid the behavior of opening a new whatsapp web session. Specially since you would loose any drafts you were typing in the original session. I think that it is generally preferred to have the handler open a new message in the existing whatsapp web session. – chronos00 Sep 23 '23 at 22:45
  • This doesn't work. I've tried using this when sharing a video from Youtube. I've canceled the dialog, right clicked the green button and opened it in a new tab. It opens the whatsapp web page HOWEVER it doesn't properly go to the "share" dialog. Just the regular whatsapp web homepage. Not what I expected at all. – prcastro Jul 29 '25 at 18:00