conditionally load javascript (external and internal) and keep execution order
问题 I'm looking for a way to conditionally load and keep the execution order of some javascript files (external and internal) without any library dependency. Basically, what I want to do is load them up only if the browser supports localStorage. Here's basically my shell: if (window.localStorage) { //load up JS only if it's needed var body = document.getElementsByTagName('body')[0], js1 = document.createElement('script'), js2 = document.createElement('script'), js3 = document.createElement(