Bookmarklet to take parameter

If you use a site a lot which has a varying query parameter, you may want to create a bookmarklet

* Just bookmark any page in your browser and change the Url to the below javascript.
* When clicked you get a prompt to put your query, which will directly search for the keyword in the site, in a new browser tab

Change google to your site

javascript:(function() {
    var targetUrl = "https://www.google.com/search?q=";
    new Promise (
        (setQuery) => {var input = window.prompt("Enter your query:"); if (input) setQuery(input);}
    )
    .then (
        (query) => window.open(targetUrl + query)
    );
})();


Comments

Popular posts from this blog

Girl on the window

|| world

Her cry