Load external scripts FIRST for injected DOM HTML content


/ Published in: jQuery
Save to your folder(s)

When injecting via jQuery HTML content which contains script tags referencing external scripts, which are then referenced via scripting elsewhere in the injected HTML, some browsers (Chrome) will not wait for the external scripts to load causing the internal scripts to throw an error. This code parses the external script tags, loads them seperately and then calls the callback function passing the given HTML minus the external script tags for you to inject.
---------
UPDATE: I've made this considerably more complex after some IE problems (really!). Hope it helps someone out...

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.