l3wi / mam.client.js

Masked Authentication Messaging wrapper for Javascript (Browser and Node)
GNU General Public License v3.0
15 stars 51 forks source link

fetch wasm bindings not working in electron/local apps #7

Open saschTa opened 6 years ago

saschTa commented 6 years ago

When using mam.web.js in electron or any other chromium based local web app, it will fail to load the iota-bindings-emscripten.wasm bindings. This is caused by the fetch library. It does not support file based URLs like (file://User/...). see. https://github.com/github/fetch/issues/91

Workaround for retrieving local file should be implemented.

Core-pl commented 6 years ago

iota-bindings-emscripten.wasm has to be sent to browser as mime type of "application/wasm". When you browse from local folder, it is most likely loaded as "text/plain" and throws an issue. I agree, it would be great to have it fixed.

Workaround is to force web server to send it as a proper mime. If you run apache, add .htaccess file to folder where you store .wasm file and add below commands in this file: <Files "*.wasm"> ForceType application/wasm < /Files> ***** delete space between < and / in the last row, github did not show properly the tag, so I had to add a space between characters