Closed pixelherodev closed 6 years ago
Okay, so it seems to call OnLoaded even when it fails to load. ... I'll work on that.
Ah. The wget2_data source contains this:
if (http.status == 200 || _url.substr(0,4).toLowerCase() != "http") {
Stripping the beginning of the URL is what's causing this.
It works now:
Failed to load https://google.com/: Redirect from 'https://google.com/' to 'https://www.google.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://zany80.github.io' is therefore not allowed access.
(index):79 emscURLLoader::onFailed(url=https://google.com, code=0, message=(null))
zany80.js:23 emscURLLoader::onFailed(url=https://zany80.github.io/lua/emscripten/plugins/NonExistent/Deliberate404, code=404, message=(null))
Question though: why does the IO README suggest using http and not https for the URI?
Ok, this is another one I need to look at and test a bit more carefully :) I'll try to find some time in the next 3..4 days or so.
When I wrote the IO docs I hadn't put much thought into http: vs https:, and when loading data from the same server (so not CORS), the protocol should be ignored anyway (it should use the same protocol the emscripten page was loaded with I think).
I suspect it was only using the same protocol because the http:// part was dropped. In my tests, i get errors about how http:// resources are blocked on https:// pages because I'm using this in my live code.
Did some local testing on the Oryol and Oryol-Samples webpage and it looks fine I think. It's a tiny bit bigger then before (<1%) but that's ok.
Thanks for the PR :)
no problem!
Switches to wget2_data as per the comments. Testing right now.