使用給定函數發佈消息,但得到錯誤「DataCloneError:對象無法克隆。」在線「target ['postMessage'](message,target_url.replace(/([^:]+://[^/]+).*/,'$ 1'));」在FireFox-34中,相同的代碼在Chrome和舊版本的FireFox上工作正常。「DataCloneError:無法克隆該對象。」 in FireFox 34
var storage = function() {
return {
postMessage : function(message, target_url, target) {
if (!target_url) {
return;
}
var target = target || parent; // default to parent
if (target['postMessage']) {
// the browser supports window.postMessage, so call it with a targetOrigin
// set appropriately, based on the target_url parameter.
target['postMessage'](message, target_url.replace(/([^:]+:\/\/[^\/]+).*/, '$1'));
}
}
}
}();
發生錯誤時試圖發佈的「消息」的類型是什麼? Blob或文件也許? – 2015-01-22 22:10:18