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.
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.
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