在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
答案 0 :(得分:0)
解决它像:
<script>
function for_print(){
window.frames["printf"].focus();
window.frames["printf"].print();
var newWin = window.frames['printf'];
}
</script>
<iframe style="display:none;" id="printf" name="printf" src="demo.html"></iframe>
<iframe src="demo.html" id="PDFtoPrint" style="display:none;"></iframe>