I'd like to know if I can load an external JS dynamically based on some condition, for example:
$(window).load(function () {
if($.browser.msie && $.browser.version=="6.0") {
// load ie.js
// do stuff using ie.js
}
});
I'd like to know if I can load an external JS dynamically based on some condition, for example:
$(window).load(function () {
if($.browser.msie && $.browser.version=="6.0") {
// load ie.js
// do stuff using ie.js
}
});
JQuery's GetScript should do it.
$.getScript("yourscirpt.js", function() {
alert('Load Complete');
});
Use $.getScript(url,callback)
; it loads the script, and executes it.
If not using jquery, use this to include js
document.writeln('<script type="text/javascript" src="your.js"></script>');