
Lately, I’ve been burned by the size restriction that IE enforces on favelets. I exported a bunch of them to my flash drive, and happily imported them when I got to my home PC. Then, I went back to work and imported them again. Well, IE silently trimmed them down to 259 characters. Since the corrupt versions were imported over both of the locations I keep my favelets, I lost quite a bit of code—some with details that I don’t remember well enough to bother re-writing completely from scratch.
But recently I realized that the size limit need not be a problem. After all, we are talking about a dynamic language! Here is what I came up with:
(function()
{
var s,f;
//put your favelets url here
f="http://www.protoscript.net/favlets/site_search.js";
s=document.createElement("SCRIPT");
s.setAttribute("src",f);
s.setAttribute("type","text/javascript");
document.getElementsByTagName("HEAD")[0].appendChild(s);
})()
The base script, without the URL defined, weighs in at 196 characters. With 63 characters left to define my URL, I shouldn’t need to worry about losing my favelets ever again. If you want the one-line version, email me and I will send it to you.
NB: I know, I know, I should be using firefox. Greasemonkey just might be the proverbial straw. But I have quite an emotional investment in IE, and I need to code specifically for it at work. Soon, perhaps…
* * *