Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24759
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: strange splits |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <q3chp9p46ron6497svevkvlurllkeh26ci@4ax.com> <c7kip95ijtb9k8v58ka90k02396g5e6fpv@4ax.com> |
| Date | 2014-06-12 10:18 +0200 |
| Message-ID | <XnsA34A68D747DAEeejj99@194.109.133.133> (permalink) |
Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> wrote on 12 jun 2014
in comp.lang.javascript:
> On Wed, 11 Jun 2014 12:41:45 -0700, Roedy Green wrote:
>
>>Vendors give me snippets of JavaScript to insert in my webpages.
>>
>>Sometimes I see code like this:
>>
>> document.write("<sc"+"ript type='text/javascript'...
>>
>>Why don't they write that as:
>>
>> document.write("<script type='text/javascript'...
>
> That is because under some circumstances the <script ... tag may
> be processed before the document.write(... is executed. The
> split prevents the recognition of the <script ... tag.
Indeed, that is what I read over and over again.
Is it [still] true in modern browsers?
Questions:
When will this script execute?
Immediately?
Meseems the whole approach only makes sense for
adding an external script by a script.
=========================
Now when the page has finished loading,
using the DOM to add such script node,
by onload = .. or interactive like onclick = ...,
seems the way to go:
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'http://????/???.js';
document.body.appendChild(s);
Questions:
When will this execute?
Immediately?
Only after the appendChild()?
Is the appendChild() even necessary for execution?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
strange splits Roedy Green <see_website@mindprod.com.invalid> - 2014-06-11 12:41 -0700
Re: strange splits John C <rescattered@gmail.com> - 2014-06-11 13:06 -0700
Re: strange splits Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2014-06-12 09:05 +0200
Re: strange splits "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-12 10:18 +0200
Dynamically inserting script elements (was: strange splits) Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-14 17:55 +0200
Re: Dynamically inserting script elements Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-14 21:43 +0200
Re: Dynamically inserting script elements Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-16 19:36 +0200
Re: strange splits John Harris <niam@jghnorth.org.uk.invalid> - 2014-06-12 11:49 +0100
csiph-web