It is not possible to print the iframe in IE using php, javascript, instead it prints the current page, which has a print button, and when we click the "Print" button, it is displayed on the index.php page, instead it should remain on the current page, in which there is a print button. my code is as follows.
<iframe id="frame1" src="splits-sorting-print.php" name="frame1" style="display:none;"></iframe>
<a href="javascript:void(0);" onclick="frames['frame1'].print()" class="btn btn-back" ><i class="fa fa-print"></i>Print</a>
I also tried in a different way, but did not work
<script type="text/javascript">
function printie()
{
try
{
iframe = document.getElementById('frame1');
iframe.contentWindow.document.execCommand('print', false, null);
}
catch(e)
{
window.print();
}
}
</script>
<a href="javascript:void(0);" onclick="printie();" class="btn btn-back" ><i class="fa fa-print"></i>Print</a>
Everything works fine with chrome and fox except IE. Please help me with this problem. Thanks in advance.
source
share