I am developing a small HTML5 web application that users can use offline with their cross-platform browsers. They will get the wep application on the CD or USB stick and double-click the HTML file. Then the HTML file loads CSS, JavaScript, etc ... files all locally from the same directory / subdirectories.
So far so good. But I also want to download a file (also local, from the same directory) that contains JSON, and use this data to build the DOM part.
$.getJSON("playlistcontent.json", function (json) {
Here I came across the famous
Null origin is not allowed through Access-Control-Allow-Origin
error. There are many resources in this, even fairly similar questions . But since it is intentionally local, the proposed solutions do not work.
However, since AJAX is “asynchronous,” I think there is probably a more “synchronous” or other approach? What about JSONP?
Note. I know that I can launch a browser (especially Chrome) with the security check disabled, but this is not an option for my users.
source share