Q: Strange jQuery load issues in IE I am using the following code when my widget loads to load in dependencies:
My widget is loaded on other pages so jQuery conflicts can appear this is why i am using the method below to avoid that. (Works perfect in all browsers except IE)
function ScriptLoadHandler(load) {
    var self = this;
    self.loaded = false;
    self.load = function () {
        if (!self.loaded) {
            load();
            self.loaded = true;
        }
    };
}

function loadScript(scriptURL, afterLoad) {
    var newScript = document.createElement('script');
    newScript.src = scriptURL;
    newScript.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(newScript);

    if (typeof afterLoad === "function") {
        afterLoad = new ScriptLoadHandler(afterLoad);
        newScript.onreadystatechange = afterLoad.load;
        newScript.onload = afterLoad.load;
    }
}

loadScript('http://code.jquery.com/jquery-1.8.3.js', function () {
    loadScript('http://code.jquery.com/ui/1.9.2/jquery-ui.js', function () {
            // Load all of our $ dependancies before calling noConflict
            js13 = jQuery.noConflict(true);
            main(); // this is the main application function
    });
});

However in IE i am getting the following error:
SCRIPT5009: 'jQuery' is undefined 
jquery-ui.js, line 6 character 1

SCRIPT5009: 'jQuery' is undefined 
jquery.cookie.js, line 14 character 3

SCRIPT438: Object doesn't support property or method 'cookie' 
widgetTest.js, line 107 character 6

Any ideas?

A: See the code at the bottom of this page
