Last active
August 26, 2023 07:28
-
-
Save jabranr/7d022861d93dcc1af077bb44e579efa5 to your computer and use it in GitHub Desktop.
WhatsApp bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use this bookmarklet to start WhatsApp chat without saving a contact first | |
*/ | |
(function(){ | |
let phone = window.prompt('Enter phone with country code'); | |
if (Boolean(phone)) { | |
phone = phone.startsWith('+') ? phone : phone.startsWith('0') ? phone.replace(/^0+/, '+') : phone.padStart(phone.length+1, '+'); | |
window.open(`https://wa.me/${phone}`); | |
} | |
}()); | |
/** | |
* Minified code | |
* !function(){let t=window.prompt("Enter phone with country code");Boolean(t)&&(t=t.startsWith("+")?t:t.startsWith("0")?t.replace(/^0+/,"+"):t.padStart(t.length+1,"+"),window.open(`https://wa.me/${t}`))}(); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment