Stooney Posted April 12, 2011 Share Posted April 12, 2011 I've got a decently large web app which works great in both Firefox and Chrome. Note: All of the javascript files depend on JQuery. Long story short: the index template file is loaded, filled with content, then output to the browser. There are multiple javascript files to load at this point. The include for the jquery file is in the header, and variably throughout the site other javascript files are included as needed. With IE, sometimes some javascript files get loaded it seems before the actual jquery file, causing errors like 'Object expected' at line 1 char 1, therefore breaking all of the javascript on the page. The only way around this is to keep refreshing the page until things load properly, at which point everything is fine. Is there a trick to get IE to load javascript files in a specific order? Or what am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/233511-ie-multiple-javascript-files-loading-out-of-order-sometimes/ Share on other sites More sharing options...
nogray Posted April 12, 2011 Share Posted April 12, 2011 This might not be a loading problem, but an execution time problem. The browser might load the JS file and continue on the page and load the next file, but there might be a delay in executing the first file and the second file start executing which causes the error. This can happen specilly if you are loading locally or from cache. To avoid this problem, make sure all your functions are in the ready function or add a defer="defer" to your additional script tags (after the jq). Quote Link to comment https://forums.phpfreaks.com/topic/233511-ie-multiple-javascript-files-loading-out-of-order-sometimes/#findComment-1200769 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.