Make life a little easier with Bookmarklets
What are Bookmarklets? As far as I can tell they are simply Bookmarks that use JavaScript or, as the "official" site puts it:
a tiny program (a JavaScript application) contained in a bookmark (the URL is a "javascript:" URL) which can be saved and used the same way you use normal bookmarks.
Yeah, yeah. Less talk, give us an example! Well here is one I've written that most of us Domino developers should find useful. Use the link below and enter a string that contains characters such as =, £, & etc in the prompt box. The next prompt box you see will be the string in its URL-encoded format. You can now copy this and then paste wherever you need.
URL-Encode a string
Wait though. This is not a Bookmarklet yet. To make it in to one you need to add it to your Favourites menu. Assuming you use IE, right click the link and choose "Add to favorites..", ignore any messages about it not being safe (trust me, it is). Now, whenever you need to check what the URL-encode is for a particular string is, you can do it straight from the Favourites menu of your browser. Cool.
The above Bookmarklet goes part way to demonstrating their power, but doesn't show that when you call a Bookmarklet it is being called "from" the page you are currently in. So from any web-page you can now do things like: Change background colour back to white (This page already is so click here to make it red), List all Email links, Email the location to a friend etc.
There are literally hundreds to choose from on Bookmarklets.com along with an explanation that should fill any of the gaps I'm sure to have left out.
So far the URL-Encode Bookmarklet is the only one I have dreamt up that I feel is worthy of sharing. As and when I think of others that we Domino developers could all use, I'll add them here.
Page designers conscious of accessibility issues and using IE5+ can take a look at what a page looks like without any stylesheets or what colour-blind people might see.
Finally, if you feel creative and start creating your own be sure to let us all know using the "Comment" link.
Note: IE5+ users who like the look of these can use this link to automatically import the following Bookmarklets:
- URL-Encode
- Set background to white
- Remove stylesheets
- Email location to a friend
Nice one, here's an improvement...
I've made lots of these "bookmarklets" in my time, without knowing i did. I recently discovered an additional feature, that enables me to take these "bookmarklets" to the right-click menu in IE5+. This is nice for framebased sites, where you want to apply the bookmarklet to a certain frame.
It works like this: You need to store the bookmarklet on your HD in a certain file, and point to it using a special registry key (see example). Notice the use of external.menuArguments - this is required to get the window you right-click on.
Example: (cookie.htm) <script> win = external.menuArguments if (win.document.cookie!="") { u="Cookies:\n----------\n"; s=win.document.cookie.split("; "); for (i=0;i<s.length;i++) u+=s[i]+"\n"; alert (u); } else alert ("No cookies"); </script>
(commands.reg) REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Show &Cookies] @="c:\\IE Commands\\cookie.htm"
This example requires the cookie.htm file to be placed in c:\IE Commands directory, but it can be placed anywhere. Just modify filepath in commands.reg file.
Best regards, /Claus
Reply
Re: Nice one, here's an improvement...
When you say "recently discovered" was it on this site by chance? I wrote about do this a while ago in [<a href="area/7FE96A40EC1955BD8625698A003ABBE5?OpenDocument">this article</a>]. I notice we use the same directory.
Since then I have written and used them for all sorts of things.. Yet another reason why IE is so much better than NN!!
Jake -CodeStore
Reply
Auto-bookmark link doesn't work in IE6
Hey Jake.
I love this article. I search for it and add bookmarks to my browser at just about every on-site client I work at. Just wanted to send you a quick note to say that the "use this link" link doesn't work for me anymore. I'm using IE 6.0
Reply
Re: Auto-bookmark link doesn't work in IE6
Woops. I was checking solely for IE 5. Call myself a professional? Fixed now! Jake
Reply