Search code examples
webassembly

Can I upload to webassembly without Javascript


Can I load the hello-world.wasm file without this code but directly into the browser from html without javascript

const runWasmAdd = async () => {
  // Instantiate our wasm module
  const wasmModule = await wasmBrowserInstantiate("./hello-world.wasm");

  // Call the Add function export from wasm, save the result
  const addResult = wasmModule.instance.exports.add(24, 24);

  // Set the result onto the body
  document.body.textContent = `Hello World! addResult: ${addResult}`;
};
runWasmAdd();

Solution

  • Can I load the hello-world.wasm file without this code but directly into the browser from html without javascript

    No, you cannot initialize a webassembly module in the browser without using Javascript.