I have an enscripten-wrapped C++ library, and running it in a local webserver works fine. But when I try to drop the .js and .wasm files onto another server and include it in a block like this:
<script src="http://www.coolprop.sourceforge.net/jscript/coolprop.js"></script > In my HTML, I get CORS errors (see below). I've set the MIME type on the WASM successfully, but this is a classic CORS problem I surmise. Can somebody point me to an example of a properly functioning publishing of js+wasm combo that can be successfully included in another script in the manner that I have tried to do? The emscripten docs on this topic are decidedly unhelpful: https://emscripten.org/docs/compiling/Deploying-Pages.html#prepare-for-the-web-environment wasm streaming compile failed: TypeError: NetworkError when attempting to fetch resource. coolprop.js:1651:11 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> falling back to ArrayBuffer instantiation coolprop.js:1652:11 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.wasm. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).[Learn More] both async and sync fetching of the wasm failed coolprop.js:10604:5 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> both async and sync fetching of the wasm failed coolprop.js:10605:5 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> failed to asynchronously prepare wasm: abort("both async and sync fetching of the wasm failed") at jsStackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1048:13 stackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1065:12 abort@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:10615:44 getBinary@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1554:7 getBinaryPromise/<@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1568:16 coolprop.js:1638:9 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> abort("both async and sync fetching of the wasm failed") at jsStackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1048:13 stackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1065:12 abort@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:10615:44 getBinary@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1554:7 getBinaryPromise/<@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1568:16 coolprop.js:10604:5 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> abort("both async and sync fetching of the wasm failed") at jsStackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1048:13 stackTrace@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1065:12 abort@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:10615:44 getBinary@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1554:7 getBinaryPromise/<@http: //www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js:1568:16 coolprop.js:10605:5 <http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.js> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.coolprop.dreamhosters.com:8010/binaries/Javascript/coolprop.wasm. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).[Learn More] -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
