Javascript Bookmarklet fails in IE8

Posted by songdogtech on Stack Overflow See other posts from Stack Overflow or by songdogtech
Published on 2010-03-12T21:46:46Z Indexed on 2010/03/13 21:05 UTC
Read the original article Hit count: 479

Filed under:
|
|

Anyone want to take a stab at why this bookmarklet fails in IE8? It turns all text uppercase in Friefox and Safari. But in IE8, it simply stalls with "loading..." I've enabled scriplets and the security settings in IE8.

Update 3/13/10: I've discovered that IE limits the data length of Favorites, so I need to find a work around to prevent IE from truncating the bookmarklet.

javascript:
(function(){
   var i,t,D=document;
  for(i=0;t=D.getElementsByTagName('textarea')[i];++i)
    t.value=t.value.toUpperCase();
   var newSS,styles='*{text-transform:uppercase}input,textarea{text-transform:none}';
  if(D.createStyleSheet){
    D.createStyleSheet("javascript:'"+styles+"'");
  }
  else{
    newSS=D.createElement('link');
    newSS.rel='stylesheet';
    newSS.href='data:text/css,'+escape(styles);
    D.documentElement.childNodes[0].appendChild(newSS);
  }
}
)()

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about bookmarklet