tags:

views:

977

answers:

3

I have a page with a "Print" link that takes the user to a printer-friendly page. The client wants a print dialog box to appear automatically when the user arrives at the print-friendly page. How can I do this with javascript?

+4  A: 
window.print();

should do it... usless you mean a custom looking popup.

Mark
+4  A: 

You could do

<body onload="window.print()">
...
</body>
mmiika
+1  A: 

I do this to make sure they remember to print landscape, which is necessary for a lot of pages on a lot of printers.

<a href="javascript:alert('Please be sure to set your printer to Landscape.');window.print();">Print Me...</a>

or

<body onload="alert('Please be sure to set your printer to Landscape.');window.print();">
etc.
</body>
Eli