我正在尝试打开一个窗口,其中包含已下载pdf的url。但它抛出错误“错误:访问属性'addEventListener'的权限被拒绝”。错误出现在firefox中,在chrome中工作正常。
我用Google搜索并发现这是由于跨域政策。以下是我的代码
var printWindow = window.open(fileUrl, 'Print', 'left=0, top=0, width=' + pdfResolution.w + ', height=' + pdfResolution.h + ', toolbar=0, resizable=0');
printWindow.addEventListener('load', function () {
printWindow.print();
}, true);
此外,生成的fileUrl类似于blob:https%3A // domain.com / e597b770-8d11-48ab-b458-782af519be27
建议我如何超越此限制,以便打开下载的pdf的打印预览。
答案 0 :(得分:0)
一周之后我禁用了牵强木偶(FF):
capability.setCapability("marionette", false);
修复一切。