HTML5 Web Workers work in Firefox 4, but not in Chrome 12.0.742.122

后端 未结 2 1177
萌比男神i
萌比男神i 2020-12-16 19:44

When I tried to play around with Web Workers feature in HTML5, my firefox works happily but chrome complains that:

Uncaught TypeError: Cannot call met

2条回答
  •  温柔的废话
    2020-12-16 20:34

    Chrome can use worker locally without the --allow-file-access-from-files. The worker needs to be loaded as a blob.

    Example:

    
        
        

    The file worker_lib2.js :

    function hello(msg) {
        return 'Hello... ' + msg;
    }
    

提交回复
热议问题