Forum Moderators: open

Message Too Old, No Replies

print iframe content

         

ddr18

6:19 am on Apr 5, 2016 (gmt 0)

10+ Year Member



<iframe name="myFrame" id="myFrame" width="600" height="400" src="http://www.w3schools.com"> </iframe>
<input type="button" value="Print" onclick="printFunction(myFrame);" />

<script>
function printFunction(iPrint)
{
iPrint.focus();
iPrint.print();
}
</script>

here in src if i give link like [w3schools.com...] i am not able to print iframe content. but if i give it as www.w3schools.com in the iframe an error msg is being displayed and im able to print it. could u help me in this.

Andy Langton

9:40 pm on Apr 7, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is the iframe on the same domain as the parent page? If not, security settings are likely to be preventing this from working.