javascript - Bookmarklet not working on IE9 -
this code works on firefox , chrome not ie9. works on same domain in ie9 fails on other domains. console shows me script1002 : syntax error. have code in jsp , loading script tag using {domain}/path controller.
( function(){ var v = "1.9.1"; if (window.jquery === undefined || window.jquery.fn.jquery < v ) { var done = false; var script = document.createelement("script"); script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js"; script.onload = script.onreadystatechange = function(){ if (!done && (!this.readystate || this.readystate == "loaded" || this.readystate == "complete")) { done = true; initbookmarklet(); } }; document.getelementsbytagname("head")[0].appendchild(script); } else { initbookmarklet(); } function initbookmarklet(){ //do stuff here } }());
try writing this
var v = "1.9.1"; if (window.jquery === undefined || window.jquery.fn.jquery < v) { var done = false; var script = document.createelement("script"); script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js"; script.onload = script.onreadystatechange = function () { if (!done && (!this.readystate || this.readystate == "loaded" || this.readystate == "complete")) { done = true; initbookmarklet(); } }; document.getelementsbytagname("head")[0].appendchild(script); } else { initbookmarklet(); } function initbookmarklet() { //do stuff here }
Comments
Post a Comment