View Full Version : [FIXED-604] onReady doesn't fire in IE7 sometimes

3 Dec 2009, 3:41 PM

<link rel="stylesheet" type="text/css" href="ext-3.0.2/resources/css/ext-all.css" />

<script type="text/javascript" src="ext-3.0.2/adapter/ext/ext-base.js" ></script>
<script type="text/javascript" src="ext-3.0.2/ext-all.js" ></script>

<script type="text/javascript">


var testPanel = new Ext.Panel({
width: 175,
height: 30,
frame: true,
items: {html:'ExtJS loaded successfully!'},
renderTo: document.body
setTimeout("window.location.reload()", 500);

<p>ExtJS 3.X onReady Test Page</p>

If you run the above HTML file in IE7 from a webserver (off the filesystem doesn't have enough latency to cause the issue apparently) eventually the page will fail to load, getting stuck during the loading of ext-all.js for some reason.

The contents of the onReady block are simply to demonstrate that ExtJS finished loading and save the user the annoyance of hitting refresh until the bug happens. It can be removed and the page will still get stuck loading eventually, even when the only thing present is the ExtJS includes. The timeout delay can be set a high as you want, the issue will still occur eventually. Keeping it low only raises the statistical likelihood of the event occuring sooner rather than later.

I realize IE7 is not the optimal browser to be using, but it is supposed to be supported and our entire company is stuck on it for the forseeable future. Has anyone else encountered this problem, and if so is there a solution?

EDIT: Interestingly enough, if you hit the X button in IE when the issue occurs the page will finish loading. I think doing that forces the onReady event to fire. Also, I have confirmed this issue occurs using ExtJS 2.2.x as well.

3 Dec 2009, 4:30 PM
It looks like making the following changes in ext-all.js fixes this issue (my test page has run for 10 minutes without issue -- approximately 2500 requests). Looks like it may simply not be safe to fire the onReady event prior to the window.onload event in IE7.

EDIT: In case it isn't obvious, the changes are where I commented out a significant portion of the method.

function initDocReady(){
var COMPLETE = "complete";

docReadyEvent = new Ext.util.Event();
if (Ext.isGecko || Ext.isOpera) {
DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
} else if (Ext.isIE){
DOC.write("<s"+'cript id=' + IEDEFERED + ' defer="defer" src="/'+'/:"></s'+"cript>");
DOC.getElementById(IEDEFERED).onreadystatechange = function(){
if(this.readyState == COMPLETE){
} else if (Ext.isWebKit){
docReadyProcId = setInterval(function(){
if(DOC.readyState == COMPLETE) {
}, 10);
// no matter what, make sure it fires on load
E.on(WINDOW, "load", fireDocReady);

3 Dec 2009, 4:33 PM
There's a patch on the forums we'll be looking at after 3.1 goes out to update the onReady code to be more stable.

3 Dec 2009, 4:36 PM
If the speed difference doesn't bother us then this simple fix should work in the interim too, right?

4 Dec 2009, 8:13 AM
Evan it talking about this thread (http://www.extjs.com/forum/showthread.php?p=390188#post390188).

28 Jan 2010, 5:07 AM
3.1 is out now, and this onready issue is still quite prevalent. What are the plans to address??

Jamie Avins
18 Feb 2010, 3:09 PM
Moving this to bugs

25 Feb 2010, 3:41 PM
using the defer tag in combination with Ext.onReady fixed the problem which was only occuring in IE7.


3 Mar 2010, 10:11 AM
False alert the defer tag did not work, even if referencing an external .js.

What did work was JQuery 1.4.2. I'm using EXT 2.3 after reverting from EXT 3.1.1 due to performance issues and replaced



$(document).ready(function() {MyApp.init();}


3 Mar 2010, 6:56 PM
The onReady fixes have gone into the core, they will be out as part of 3.2.