Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active May 15, 2023 18:50
Show Gist options
  • Save mfd/d0d35858eb15d20985864e69accedc4a to your computer and use it in GitHub Desktop.
Save mfd/d0d35858eb15d20985864e69accedc4a to your computer and use it in GitHub Desktop.
JS Bookmarklets for Chrome and iOS

Browser JS bookmarklets

Generate and test

https://caiorss.github.io/bookmarklet-maker/

Write WhatsApp message to non-contact list user

javascript: (() => {
    let targetUrl = "http://wa.me/";
    let formatPhoneNumber = (str) => {return ('' + str).replace(/\D/g, '')}
    new Promise (
        (setQuery) => {let input = window.prompt("WhatsApp number:"); 
        if (input) setQuery(input);}
    )
    .then (
        (query) => window.open(targetUrl + formatPhoneNumber(query))
    );
})();

Open address in 2GIS

javascript: (() => {
    let targetUrl = "https://2gis.kz/almaty/search/";
    new Promise (
        (setQuery) => {let input = window.prompt("2GIS address:"); 
        if (input) setQuery(input);}
    )
    .then (
        (query) => window.open(targetUrl + query)
    );
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment