Forum Moderators: open

Message Too Old, No Replies

How do I get a page to automatically print after it's loaded?

         

partha

11:38 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



I think I've seen this before. Can it be done through javascript?

skipfactor

11:42 pm on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



top of code (line 1):

<SCRIPT Language="JAVASCRIPT">
window.print();
</script>

Rambo Tribble

2:38 am on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be prudent to fire the print with the window's onload event, as per:

<script type="text/javascript">
window.onload=function(){self.print();}
</script>

skipfactor

2:51 am on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



define: prudent :)

Rambo Tribble

3:45 am on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was thinking c.y.a. vis-a-vis browser dissimilarity.

bluefish

10:18 am on Feb 19, 2005 (gmt 0)

10+ Year Member



Hi!

the code above is perfect! it helps me a lot. :)
But how is it possible, to close that window, automatically, after I printed that out?
Many thx!
BF