Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22194
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: onload and order |
| References | <D-adnXLr779cjAjPnZ2dnUVZ_vmdnZ2d@westnet.com.au> |
| From | Archenoth <Archenoth@live.something> |
| Message-ID | <op.w66x88q8bm00eh@hathor> (permalink) |
| Date | 2013-11-26 22:47 -0600 |
On Tue, 26 Nov 2013 15:24:09 -0600, Andrew Poulos <ap_prog@hotmail.com>
wrote:
> I have a page laid out like this
>
> <!DOCTYPE html>
> <html>
> <head>
> ...
> <script type="text/javascript" src="scripts/a.js"></script>
> ...
> </head>
> <body>
> ...
> <script type="text/javascript">
> // b
> </script>
> ...
> </body>
> </html>
>
> "a.js" has a window.onload
>
> Interestingly Chrome and Opera run the code at "b" after the onload is
> triggered but only if the page is on a web server. If the page is on my
> local file system the code at "b" runs first.
>
> Andrew Poulos
script tags are run as they are read, I believe the variation is just a
matter of file:// (local) reading faster than http:// (downloaded).
window.onload = function(){}; will execute when the entire page is loaded.
That very well might be enough time for the code in the script tags at "b"
to run, with a higher likelihood to run first the longer it takes to
download a.js.
--
The arch foe
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
onload and order Andrew Poulos <ap_prog@hotmail.com> - 2013-11-27 08:24 +1100
Re: onload and order Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-26 23:06 +0100
Re: onload and order Andrew Poulos <ap_prog@hotmail.com> - 2013-11-27 10:15 +1100
Re: onload and order Andrew Poulos <ap_prog@hotmail.com> - 2013-11-27 11:35 +1100
Re: onload and order Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-27 01:39 +0100
Re: onload and order Archenoth <Archenoth@live.something> - 2013-11-26 22:47 -0600
Re: onload and order John Harris <niam@jghnorth.org.uk.invalid> - 2013-11-27 15:18 +0000
Re: onload and order Andrew Poulos <ap_prog@hotmail.com> - 2013-11-28 09:44 +1100
csiph-web