Reputation: 836
I'm using this approach: https://stackoverflow.com/a/25796908/3437433
It works like a charm, but when I'm trying to use it in Safari (both desktop and mobile), then quite strange things happen.
On desktop, origin link https://wa.me/?text=123
is somehow replaced with whatsapp://send?text=123
. And then Safari displays error page about wrong protocol.
On mobile, correct page is opened by origin link, but also alert appears saying "can't open page because url is wrong". I can close that alert, can click on "send" button, but then https://whatsapp.com/download/
page is opened, instead of prompting to login to whatsapp and redirecting to chat.
Does anybody know what's going on here and whether it can be fixed?
Upvotes: 3
Views: 8021
Reputation: 20861
Official Sharing Documentation For WhatsApp. They say to use their wa.me/...
URL. Okay! So let's try it out! http://wa.me/?text=mytest For me, I get an error message...
PAGE NOT FOUND
However, these seem to work great for me!
https://api.whatsapp.com/send?text=YourShareTextHere
https://api.whatsapp.com/send?text=YourShareTextHere&phone=123
If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#whatsapp
Upvotes: 2
Reputation: 31
We usually differ link at desktop view and mobile view to offer support for safari and other browser. for desktop view we use https://web.whatsapp.com/send?phone=6200000000&text=Hello%20Moxqitto
for mobile, we follow whatsapp best practice https://faq.whatsapp.com/en/android/26000030/ https://wa.me/6200000000
Tested on Chrome for mac safari for mac android chrome
Ps: not tested when mac have whatsapp desktop app, but it will still work in the safari itself. so it should be ok
Upvotes: 2