错误:拒绝访问属性'addEventListener'的权限

错误:拒绝访问属性'addEventListener'的权限

问题描述:

我正在尝试打开一个窗口,其中包含已下载pdf的url。但它抛出错误错误:权限被拒绝访问属性'addEventListener'。错误出现在firefox中,在chrome中工作正常。

I am trying to open a window with url passed of a pdf downloaded. but it throws error "Error: Permission denied to access property 'addEventListener'". The error show up in firefox, in chrome it is working fine.

我用Google搜索并发现它是由于跨域策略。以下是我的代码

I googled and figured out it is due to the cross domain policy.Given below is my code

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

Also, the fileUrl generated is like blob:https%3A//domain.com/e597b770-8d11-48ab-b458-782af519be27

建议我如何超越此限制,以便打开下载pdf的打印预览。

Suggest how can i surpass this restriction so that i open the print preview for the downloaded pdf.

一周之后,我禁用牵强木偶为FF(java):

After a week I disable marionette for FF (java):

功能。 setCapability(marionette,false);

维修一切