在Safari中显示以下错误。
无法在“ URL”上执行“ createObjectURL”:未找到与提供的签名匹配的函数。
我的代码是:
function createObjectURL(object) {
return (window.URL) ? window.URL.createObjectURL(object) : window.webkitURL.createObjectURL(object);
}
这是我的图像代码:
function myUploadOnChangeFunction() {
if (this.files.length) {
for (var i in this.files) {
if (this.files.hasOwnProperty(i)) {
var src = createObjectURL(this.files[i]);
var image = new Image();
image.src = src;
imagSRC = src;
$('#img').attr('src', src);
}
}
}
}
window.URL.createObjectURL('broken')
引发错误:Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
createObjectURL(...)
遇到错误时,您要传递给函数什么?