Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22193
| Message-ID | <1539881.xPIgsfFhHx@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-11-27 01:39 +0100 |
| Subject | Re: onload and order |
| Newsgroups | comp.lang.javascript |
| References | <D-adnXLr779cjAjPnZ2dnUVZ_vmdnZ2d@westnet.com.au> <1669404.HQe8P1OAMC@PointedEars.de> <M7OdndhjZMtJtgjPnZ2dnUVZ_rKdnZ2d@westnet.com.au> <nvqdnZk-fu41owjPnZ2dnUVZ_qGdnZ2d@westnet.com.au> |
Andrew Poulos wrote: > On 27/11/2013 10:15 AM, Andrew Poulos wrote: >> On 27/11/2013 9:06 AM, Thomas 'PointedEars' Lahn wrote: >>> Andrew Poulos 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. >>> >>> “http://” vs. “file://”? >> >> Yes. >> >>> Which versions? >> >> On Windows Vista SP 2 with Opera 18.0, Chrome 31.0.1650.57 m, and IIS >> 7.0.6000.16386. > > I "solved" the issue by moving > <script type="text/javascript" src="scripts/a.js"></script> > to the bottom of the page. I can only test later, but ISTM there is a race condition which would mean that you cannot rely on that. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
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