PDA

View Full Version : Loading Ext from AJAX in IE



si-rus
18 Jun 2007, 6:39 AM
Most likely it is the BUG

At loading HTML page in which library Ext using AJAX in IE, there is a problem in this place


var initDocReady = function () {
.....

} else if (Ext.isIE) {
// inspired by http: // www.thefutureoftheweb.com/blog //2006/6/adddomloadevent
document.write (" <s " + ' cript id = "ie-deferred-loader" defer = "defer" src = " / ' + '/: "> </s' + " cript> ");
var defer = document.getElementById ("ie-deferred-loader");
defer.onreadystatechange = function () {
if (this.readyState == "complete") {
fireDocReady ();
defer.onreadystatechange = null;
defer.parentNode.removeChild (defer);
}
};
}

.....


If to make so




var initDocReady = function () {
.....

} else if (Ext.isIE) {
var defer = document.createElement('script');
defer.id = "ie-deferred-loader";
defer.defer = "defer";
defer.src = "/' + '/:";
document.getElementsByTagName ('head')[0].appendChild(defer);
defer.onreadystatechange = function () {
if (this.readyState == "complete") {
fireDocReady ();
defer.onreadystatechange = null;
defer.parentNode.removeChild(defer);
}
};
}

.....



Then the error does not arise

si-rus
9 Aug 2007, 2:46 PM
At loading Ext scripts using AJAX (to be exact AHAH http://en.wikipedia.org/wiki/AHAH) - syntax document.write - throws exception! Therefore as document.write it can not be used after the ending of loading of the document. I have above described a simple exit from a this situation.

jack.slocum
9 Aug 2007, 3:03 PM
Please do a search before posting, this was just discussed a couple days ago in this forum.

si-rus
9 Aug 2007, 10:14 PM
Hi Jack.

You say about this post ? "Problem in IE6+ when loading Ext-all.js using ondemand javascript" http://extjs.com/forum/showthread.php?t=10502

If yes, a problem for us similar but solution a miscellaneous


Anyhow, today I shall make in the my AHAH library a trap and processing document.write.

But, I suggest to refuse usage document.write in Ext and there will be no problems, on it will not be necessary to additional a "body-movements". In my opinion this elegant solution.


P.S.: I am very impressed of your JS framework. You make the future.