0

In Chrome it works fine, but in Firefox I get this error:

Error: Permission denied to access property 'print'

My code:

<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>

I see this bug on firefox forum.Is it solved?

Any other solutions?

Thanks!

EDIT: on IE I get this error:

SCRIPT65535: Invalid calling object
Claudiu Creanga
  • 8,031
  • 10
  • 71
  • 110

1 Answers1

0

Solved it like:

<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>
Claudiu Creanga
  • 8,031
  • 10
  • 71
  • 110