Skip to content Skip to sidebar Skip to footer

Displaying A Prompt From Javascript Chrome Bookmark

I want to create a chrome bookamrk that prompts the user for a value (and then sets that value in a cookie). I am unable to get the prompt to display. Is there a way to do this? Cu

Solution 1:

In chrome, right click on the bookmark bar and choose Add Page

Give the bookmark a name and paste the following code (adjusted for your requirements) into the URL field

javascript:(function(){var site = prompt('Website?');var link = `https://whois.icann.org/en/lookup?name=${site}`;window.location.href = link;})();

Solution 2:

Apparently you cannot run bookmarklets from the Chrome new tab page.

If you want to do something from there then take a look at writing a Chrome Application.

Post a Comment for "Displaying A Prompt From Javascript Chrome Bookmark"