I\'ve read the other same origin policy topics here on SO, but I haven\'t seen any solutions related to the local file system.
I have a web app (In a loose sense of
I think I've figured it out.
All I really needed to do was add a callback into my tag. Final code:
I have an element named next... So, in the $("#next").click()
function I have the following code. This only gets executed if they click "next".
//remove old dynamically written script tag-
var old = document.getElementById('uploadScript');
if (old != null) {
old.parentNode.removeChild(old);
delete old;
}
var head = document.getElementsByTagName("head")[0];
script = document.createElement('script');
script.id = 'uploadScript';
script.type = 'text/javascript';
script.src = 'test/' + scope_dir + '/js/list.js';
script.onload = refresh_page;
head.appendChild(script);
function refresh_page(){
//perform action with data loaded from the .js file.
}
This seems to work, and allows Chrome to dynamically load .js files on the local file system while circumventing the access-control-allow-origin policy I ran into while trying to use jQuery functions.