logo       

[jQuery] IE bookmarklet problems: msg#01155

lang.javascript.jquery

Subject: [jQuery] IE bookmarklet problems

Has anyone run into issues using trying to insert jQuery into a page via
js/bookmarklet after the page has loaded?


Thanks,
Chad


---- Bookmarket code

var d=document;
var
a=function(o){document.getElementsByTagName('head').item(0).appendChild(o)};

q=d.createElement('script');
q.type='text/javascript';
q.src='http://jquery.com/src/jquery-latest.js';
a(q);


--- Failing here

// If IE is used, use the excellent hack by Matthias Miller
//
http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_r
evisited
} else if ( jQuery.browser.msie ) {

// Only works if you document.write() it
document.write("<scr" + "ipt id=__ie_init defer=true " +
"src=//:><\/script>");

// Use the defer script hack
var script = document.getElementById("__ie_init");
script.onreadystatechange = function() {
if ( this.readyState != "complete" ) return;
this.parentNode.removeChild( this );
jQuery.ready();
};

// Clear from memory
script = null;

// If Safari is used
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise