Forum Moderators: open

Message Too Old, No Replies

The DEFER Attribute

Can it be in the script or the JS call

         

stcrim

11:51 pm on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does anyone know if using DEFER will work just as well in the script as in the JS call?

In the call:
<script LANGUAGE="JavaScript1.2" src=http://www.mysite.com/elevator/open.js defer='defer'></script>

In the script:
'defer'; function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);}

Will both work equally as well? And, is it the best method for getting the page loaded before loading a remote script?

-s-

Span

11:43 pm on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no "document.write" in javascript) and thus, the user agent can continue parsing and rendering.

From: [w3.org ]

So if you want the page loaded before executing your script you need <body onload="function()"> or window.onload=function() in the script.