Bookmarklets Home | Links | Forms | Text and Data | Zap | Web Development | Validation | Misc

Creating a remote control bookmarklet

Goal: create a single bookmark you can store on your personal toolbar that allows you to access several bookmarklets. This will allow you to quickly make several bookmarklets available while you temporarily use another computer or another browser. It's also one way to keep a large number of bookmarklets on your personal toolbar, although creating folders on your personal toolbar is more efficient.

As an approximation, I created a small page (remotePageLinks.html) containing several bookmarklets as links, and put a <base target="receiver"> in the page. Then, I wrote a bookmarklet that sets the name of its window to "receiver" and opens remotePageLinks.html in a new window. Here's the bookmarklet:

almost remote

The problem with this remote is that only works on pages on www.squarefree.com, due to the same-origin policy. If you try using it at another site, the remote will open, but you'll get a javascript error if you try to use any of the bookmarklets. This makes sense: opening a page at another site in a new window should not allow scripts on that site to read customers' personal data from your site!

To get around the security restriction, I created a script, remotePageLinks.js, that contains the contents of remotePageLinks.html as a javascript string and document.writes that string when loaded. Then I modified the bookmarklet to open a new window with <script src="remotePageLinks.js">. Here's the result:

remote

Note that because the script is loaded from my site every time you use the remote bookmarklet, it's not very fast.

Thanks to Daniel Schwartz for the idea of storing several bookmarklets as one "remote control" bookmarklet.


© 2000-2007 Jesse Ruderman (jruderman@gmail.com). Feedback is welcome.
Last modified October 28, 2001.