[英]Basic code works on all browsers except IE
I am able to use this code to display a PDF document except on Internet Explorer. 我可以使用此代码显示PDF文档,但Internet Explorer除外。
It says: 它说:
ReferenceError: 'fetch' is undefined ReferenceError:'fetch'未定义
I can't find much about this. 我找不到太多有关此的信息。 What can I do to make it work?
我该怎么做才能使其正常工作?
fetch("data:application/pdf;base64," + vm.documentData.base64Document).then(function(response) {
response.blob().then(function(blob) {
document.querySelector("iframe").src = URL.createObjectURL(blob) + "#view=fit";
});
});
You need to add the 'isomorphic-fetch' module to your 'package.json' and then import this. 您需要将“ isomorphic-fetch”模块添加到“ package.json”,然后将其导入。
npm install --save isomorphic-fetch es6-promise
Then in your code 然后在你的代码中
import "isomorphic-fetch"
See https://www.npmjs.com/package/isomorphic-fetch 参见https://www.npmjs.com/package/isomorphic-fetch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.