Call me...




Wednesday, December 23, 2020

Bookmarklets

These things used to be easier to get info on, there are all kinds of them!

The one type I use all the time is just the simple: Pop up a test input dialog, and search based on that text.
These thing come in handy for lots of things.
Recently, I set up a few for Helpdesk staff, so they could easily pull up iufo in the helpdesk webpage  things like, a specific support ticket, or details on a specific asset / computer, or details about a specific user.


(NOTE: I'm NOT a javascript guy.)

Save the 'Bookmarklet' the same way you would manually add a new bookmark, but the location is the javascript.

Apparently, in Google Chrome - On a 'New Tab' page, Javascript is not enabled, so in that browser, you have to have an actual web page open, for a bookmarklet to work. Google has removed the ability to open a web page when clicking to open a new tab, too...
(note: this Chrome behavior can be overridden using the ‘New Tab Redirect’ extension)


In Firefox... They just work.

Two elements that can be configured:
The Title, and the URL
(Note that in chrome, the pop up will tell you that what ever website you are on, generated the dialog)

Basic:

javascript:(function(){var p=prompt('FIND SOMETHING:','');if(p){document.location.href='https://www.google.com/search?q='+escape(p)}})();

In new tab:

javascript:(function(){var input=window.prompt("FIND SOMETHING:");var targetUrl="https://www.google.com/search?q=";if(input)window.open(targetUrl+input)})();

Variation I use, that removes non-numeric characters:

javascript:(function(){var input=window.prompt("FIND SOMETHING:");var targetUrl="https://www.google.com/search?q=";input=input.replace(/\D/g, "");if(input)window.open(targetUrl+input)})();

No comments:

Post a Comment