-
-
Save gklein/5309212da89a5c5b936746ff0cf8acf3 to your computer and use it in GitHub Desktop.
javascript: (function() { var re = /^\+?(972|0)(\-)?0?([5]{1}\d)\-?(\d{7})$/; var val=prompt("Phone Number #","");var phone=val.replace(re,'972$3$4');location="https://wa.me/"+escape(phone);})() |
Thanks for this super useful bookmarklet.
Whatsapp has recently changed their web API, and now the bookmarklet redirects to a page that requires two clicks to actually send a message.The new URL structure seem to be
https://web.whatsapp.com/send?phone=Could you please try to offer a way to resolve this and return to "one-click" so it will be less cumbersome? Thanks!!
Please scratch that previous one, I didn't have Whatsapp local client installed before. I just installed it and it works like a charm!
Bookmarklet does not work - clicking it does not trigger the pop-up window
Checked today on the following versions of Chrome:
Version 78.0.3904.97 (Official Build) (64-bit)
Version 79.0.3941.4 (Official Build) dev (64-bit)
Can you please check and resolve?
Thank you, @gklein!
I wrote my version of phone processing — https://gist.github.com/baslie/6091c3e5bc1439e3b3c3e33b8bfafee2.
The bookmarklet works as follows:
- Save the code in bookmarks, for example as "Phone to WhatsApp".
- Highlight the phone number on the page.
- Press "Phone to WhatsApp".
The only thing I need help is how to validate the phone number. I need the script to add the missing prefixes itself (e.g. country codes).
Thank you, @gklein!
I wrote my version of phone processing — https://gist.github.com/baslie/6091c3e5bc1439e3b3c3e33b8bfafee2.The bookmarklet works as follows:
- Save the code in bookmarks, for example as "Phone to WhatsApp".
- Highlight the phone number on the page.
- Press "Phone to WhatsApp".
The only thing I need help is how to validate the phone number. I need the script to add the missing prefixes itself (e.g. country codes).
You can use replace() with a regular expression in order to adapt the phone number to the required format.
Thank you, @gklein!
I wrote my version of phone processing — https://gist.github.com/baslie/6091c3e5bc1439e3b3c3e33b8bfafee2.
The bookmarklet works as follows:
- Save the code in bookmarks, for example as "Phone to WhatsApp".
- Highlight the phone number on the page.
- Press "Phone to WhatsApp".
The only thing I need help is how to validate the phone number. I need the script to add the missing prefixes itself (e.g. country codes).
You can use replace() with a regular expression in order to adapt the phone number to the required format.
Yeap, of course :) I need more practice with REGEXPs
Thank you, @gklein!
I wrote my version of phone processing — https://gist.github.com/baslie/6091c3e5bc1439e3b3c3e33b8bfafee2.
The bookmarklet works as follows:
- Save the code in bookmarks, for example as "Phone to WhatsApp".
- Highlight the phone number on the page.
- Press "Phone to WhatsApp".
The only thing I need help is how to validate the phone number. I need the script to add the missing prefixes itself (e.g. country codes).
You can use replace() with a regular expression in order to adapt the phone number to the required format.
Yeap, of course :) I need more practice with REGEXPs
Try this one:
https://www.youtube.com/watch?v=ZfQFUJhPqMM
Good luck.
I checked and the new "wa.me" version does not work anymore, at all. Better to resort to the old version.