Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Beginner
Apr 18, 2007

Use AutoHotKey to Write a JavaScript Bookmarklet to the Browser Window

To make a hotkey that does something complicated in the browser you will probably need to send a JavaScript bookmarklet to the browser address bar. For example, suppose you wanted a hotkey that sent the current page as a bookmark to del.icio.us. You'd do something like this:

Send !d 
Send javascript:location.href=
The above code re-maps the combination of the control key (^) and the d to send alt-d (the ! in AutoHotKey is a shortcut for alt) followed by a JavaScript URL which sends the current location.href to del.icio.us (this assumes, of course, that you've got a del.icio.us account and are logged in).

The {t} and the {Enter} will send the + key and the Enter key respectively, the curly brackets are used as escapes in AutoHotKey, and the + sign is generally used as a shortcut for the shift key.

Obviously, you could make variations in the hotkeys by mapping a key combination to send a JavaScript passing Del.icio.us the address of the current page and mapping another key combination to pass the domain of the current page. For example:

Send !d 
Send javascript:location.href='http://del.icio.us/post?v=4;url='{+}encodeURIComponent('http://'{+}

Click here for a more in-depth discussion of hotkeys that send JavaScript.

Bryan Rasmussen
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date