javascript - $.getScript, possible to give included script an id? -


via jquery's $.getscript method, can give included script dom id?

so generated code should be:

<script type="text/javascript" id="xxxxxx" src="..."></script> 

i know document.write line myself, $.getscript must there reason right? (cross browser compatibility, etc?)

i think has maybe been answered/discussed before here: why call $.getscript instead of using <script> tag directly?.

getscript allows dynamically load script in situations it's either desirable delay loading of script, in situations want status callback on when script has been loaded or in situations couldn't use script tag.

getscript has downsides in it's subject same-origin policy whereas script tag not.

if have seen other web pages put id on script tag (smugmug.com), i've seen flagged non-standard when testing standard's compliance. seems work , used others, i'm guessing isn't standard.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -