I want to print the content of the iframe. I viewd several examples but non of them helped me for my case. I have the following piece of code
<div id="print-area">
    <iframe src='data:text/html;charset=utf-8,<?php echo $content ?>'></iframe>
</div>
And when the #print button is clicked: (this code prints out the content of the div #print-area)
$("#print").click(function (e) {
        var newWindow = window.open();
        newWindow.document.write($('#print-area').html());
        newWindow.print()
    });
The code works and print window is prompted, but when I try to put content of the iframe in the document.write(...) the function does not work. Any idea?
tried solutions:
Print iFrame content using Javascript
and from other topics, but did not manage to print my iframe content
 
     
    