How can I check if a browser supports WebAssembly?

前端 未结 2 725
一向
一向 2021-02-01 16:03

With support for WebAssembly coming into all new major browsers, how can I check whether the current browser which is visiting my website supports it?

2条回答
  •  孤城傲影
    2021-02-01 16:08

    (Insufficent reputation to comment so....) If you're testing on older browsers the () => syntax is not supported, so it can be done as a function all instead:

    function wasmSupported() {
        // try/catch, return false; as in JF Bastien's answer
    }
        
    if(wasmSupported()) { ... }
    

提交回复
热议问题