Skip to content

Instantly share code, notes, and snippets.

@wsd1
Created June 8, 2018 08:44
Show Gist options
  • Save wsd1/c71bd20c870baa97aa837be9afb0b0ae to your computer and use it in GitHub Desktop.
Save wsd1/c71bd20c870baa97aa837be9afb0b0ae to your computer and use it in GitHub Desktop.
WebAssembly 鉴定页面
<html>
<head>
<title>WASM check</title>
</head>
<body>
<script type="text/javascript">
const supported = (() => {
try {
if (typeof WebAssembly === "object" &&
typeof WebAssembly.instantiate === "function") {
const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
if (module instanceof WebAssembly.Module)
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
}
} catch (e) {}
return false;
})();
var info = (supported ? "WebAssembly is supported" : "WebAssembly is not supported");
document.write('<h1>' + info + '</h1>');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment