【发布时间】:2014-08-06 21:11:08
【问题描述】:
在 Chrome 中它工作正常,但在 Firefox 中我收到此错误:
Error: Permission denied to access property 'print'
我的代码:
<iframe src="http://domain.com/wp-content/uploads/2014/08/CV.pdf" id="PDFtoPrint"></iframe>
<a class="" href="#" title="Print CV" onclick="document.getElementById('PDFtoPrint').focus();document.getElementById('PDFtoPrint').contentWindow.print();"></a>
我在firefox forum 上看到了这个错误。它解决了吗?
还有其他解决方案吗?
谢谢!
编辑:在 IE 上我收到此错误:
SCRIPT65535: Invalid calling object
【问题讨论】:
-
@ThomasWTupper 来自
iframe的文档位于同一网站上。我把它放在同一个文件夹中。我尝试使用http://和http://www.并得到同样的错误。根据您的链接,它应该可以工作,对吧? -
这几乎可以肯定是一个安全例外。但是您是否尝试过这里的方法:stackoverflow.com/questions/9616426/…
-
@ThomasWTupper 好的,那个正在工作。谢谢!
-
小心——我没有彻底检查它,但在我看来这是脆弱的,并不适用于所有浏览器。彻底测试。
标签: javascript firefox iframe printing