0

I'm trying to print an iframe with the code below:

function printFunction() {
    window.frames["printf"].focus();
    window.frames["printf"].print();
}
<iframe id="printf" name="printf"></iframe>

But the window does not open, and when I use another code:

function printFunction() {
    window.print();
}
<iframe id="printf" name="printf"></iframe >

The window opens, but prints the whole page (parent page), and not just the iframe.

Button "print" calls function printFunction() with onclick.

JJJ
  • 32,902
  • 20
  • 89
  • 102
jveing
  • 1
  • http://stackoverflow.com/a/9616706/1305911 – JNF Jun 01 '15 at 11:53
  • possible duplicate of [Javascript Print iframe contents only](http://stackoverflow.com/questions/9616426/javascript-print-iframe-contents-only) – JNF Jun 01 '15 at 11:53

0 Answers0