What are the possible cross browser (at least Firefox & Chrome) methods to dynamically reload a local Javascript file that is referenced by a locally loaded html file?
Background:
A local html page is being used to render some data that is formatted and displayed by two referenced Javascript files. One file contains the Javascript code, and the other file contains JSON data.
This JSON data is updated on disk by another program, and it would be nice to have the UI automatically incorporate these updates without manually reloading the page (or opening a new page).
In Firefox, I believe the issue could be resolved using AJAX to load the html, but in Chrome this will not work due to the same origin policy failures (I unfortunately cannot necessarily rely on --disable-web-security to mitigate this since all prior instances of Chrome must be closed for that to work).
The only solution I see is to run a local web server, but I am hoping for something simpler and less invasive (Perhaps loading the Javascript in an IFrame and reloading the IFrame, although I imagine this would be prevented by browser security).
Anyone have any recommendations?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…