Bug with IE's defer attribute
"John M. Hann" <[email protected]> Wed, 31 May 2006 16:51:04 -0000
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
Hi all, In a recent post I had recommended that the defer attribute be used for any scripts that did not need to be loaded to render HTML. This is meant to reduce the time to render the page. Unfortunately, this feature is plagued by yet another of IE's misguided attempts to improve performance through aggressive caching. It appears that IE has a serious flaw when using this attribute. When there are two or more script tags using the defer attribute, only the first script that is not already cached is retrieved! The following scripts are not retrieved at all. Each time the user visits the page (or refreshes it), the browser loads an additional one of the deferred scripts since it has cached the previous ones. If you revisit the page enough times, eventually they'll all be loaded. Of course, this can cause any number of javascript errors, including the oh-so-descriptive "Object expected" error. This is easy to reproduce in IE 5.01, 5.5 or 6.0: <SCRIPT type="text/javascript" src="primaryFuncs.js" defer></SCRIPT> <SCRIPT type="text/javascript" src="secondaryFuncs.js" defer></SCRIPT> <SCRIPT type="text/javascript" src="yetMoreFuncs.js" defer></SCRIPT> Mozilla and Safari act as expected. They appear to load all of the deferred files after rendering the page, but before calling any javascript events (like body.onload). Has no one seen this before? Or am I just late in figuring this one out? Thanks! -- John http://e-numera.com/ http://ajax-web2.com/ ------------------------ Yahoo! Groups Sponsor --------------------~--> You can search right from your browser? It's easy and it's free. See how. http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/9rHolB/TM --------------------------------------------------------------------~-> Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wdf-dom/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/