Results 1 to 5 of 5
Thread: Using the defer attribute
Aug 3, 2007, 21:33 #1
- Join Date
- Sep 2004
- 0 Post(s)
- 0 Thread(s)
Using the defer attribute
Does anyone know exactly what the defer attribute for the script tag is? I read that it tells the browser to load the page first (once the body tag is fully loaded) and then load the contained <script>.
If so then how does it cope with cached scripts? Say for example a <script> has already been loaded then the page is accessed again, will the <script> contents be executed right away since the contents do not have to be downloaded?
Also, if you do not have a src attribute (the contents are on the page and not in a separate file) then does the defer attribute really do anything?
I am aware that it's in the HTML specification and that it's not a MSonly thing. But this is the first time I've ever seen the defer attribute, so I don't think it's really mainstream. All of my scripts that load up when the page is loaded are triggered by window.onload and since lately I use mootools, then they are loaded after window.onDomReady.
I tried using the defer attribute with mozilla and it didn't seem to work.
How exactly does this feature work?
------- EDIT -------
Correction This feature seems to be MSonly even though it's in the HTML specification. This feature isn't really very useful for any other browsers.I can't believe I ate the whole thing