Forum Discussion
Creating downloadable pdf files in Storyline - an update on earlier methods
Hi lestyn
Sorry not to reply earlier.
Yes. I should have made the point that the Storyline example I loaded "NoteTaker.story" doesn't work if you compile it as a web app and then run it on your 'local' device. The problem is precisely as you describe - you get a CORS error.
It's a little ironic really that you cannot access a local data file from JavaScript because of a cross origin resource sharing error (unless that file is being served by a web server on the same system)... Basically it is a security issue. The browser executes the JavaScript and sends an 'Origin Header' with any 'fetch' or HTTP request. If the server's response doesn't include the appropriate CORS header, the browser will not allow the request and throws the CORS error you saw.
If you think about - it would be a little unsafe if I could just execute JavaScript code to access any data file on the local system!
If you load the Storyline output onto a web page on another server (as per my demo) everything will be fine.
There are services like Ngrok you can use to test your code locally if necessary.