window print not printing Iframe content

Window print only print the document (DOM) of window and Iframe is another document object (DOM) treat as same window object. Below code help you to print the content of iframe.

window.onload=function()
{
  window.frames["printf"].focus();
  window.frames["printf"].print();
}
<iframe src="home.html" name="printIframe"></iframe>

view demo

Share and Comment the post

 

Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes4
No1
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.