概括
blob: 适用于 Chrome 8+、Firefox 6+、Safari 6.0+、Opera 15+ 
data:application/javascript 适用于 Opera 10.60 - 12 
eval 否则(IE 10+) 
URL.createObjectURL(<Blob blob>)可用于从字符串创建 Web Worker。可以使用已弃用的BlobBuilderAPI或构造函数来创建 blob 。Blob
演示:http : //jsfiddle.net/uqcFM/49/
// URL.createObjectURL
window.URL = window.URL || window.webkitURL;
// "Server response", used in all examples
var response = "self.onmessage=function(e){postMessage('Worker: '+e.data);}";
var blob;
try {
    blob = new Blob([response], {type: 'application/javascript'});
} catch (e) { // Backwards-compatibility
    window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
    blob = new BlobBuilder();
    blob.append(response);
    blob = blob.getBlob();
}
var worker = new Worker(URL.createObjectURL(blob));
// Test, used in all examples:
worker.onmessage = function(e) {
    alert('Response: ' + e.data);
};
worker.postMessage('Test');
兼容性
以下浏览器源支持 Web Worker :
- 铬 3
 
- 火狐 3.5
 
- 浏览器 10
 
- 歌剧 10.60
 
- 野生动物园 4
 
该方法的支持是基于BlobAPI和方法的支持URL.createObjectUrl。Blob兼容性:
- Chrome 8+ ( 
WebKitBlobBuilder), 20+ (Blob构造函数) 
- Firefox 6+ ( 
MozBlobBuilder), 13+ (Blob构造函数) 
- Safari 6+(
Blob构造函数) 
IE10 支持MSBlobBuilder和URL.createObjectURL. 但是,尝试从blob:-URL创建 Web Worker会引发 SecurityError。
Opera 12 不支持URLAPI。有些用户可能有仿版URL的对象,这要归功于这个技巧在browser.js。
回退 1:数据 URI
Opera 支持数据 URI 作为Worker构造函数的参数。注意:不要忘记转义特殊字符(例如#和%)。
// response as defined in the first example
var worker = new Worker('data:application/javascript,' +
                        encodeURIComponent(response) );
// ... Test as defined in the first example
演示:http : //jsfiddle.net/uqcFM/37/
回退 2:评估
eval 可用作 Safari (<6) 和 IE 10 的后备。
// Worker-helper.js
self.onmessage = function(e) {
    self.onmessage = null; // Clean-up
    eval(e.data);
};
// Usage:
var worker = new Worker('Worker-helper.js');
// `response` as defined in the first example
worker.postMessage(response);
// .. Test as defined in the first example