Auto Window Print
Q
How can i initialize the print function in JavaScript for a printable page, so that the user doesn't need to click a print-button ?
A
Just put this little script in your page and it will initialize the print pop-up automatically.
<script>
if (window.self) window.print();
</script>
Comments
Ironic
Funny,
I was working on our Corporate Intranet today and I had a need for this code. I come on here tonight to reply to a request for help on some code I wrote and BAM, here it is.
Gotta love that! I'll use it tomorrow.
Thanks!
-Chris
RE: Ironic
help!
RE: help!
If you mean that you want the page to be loaded first and then initialize the Window Print, just put the script at the very end of your page.
You must me logged in to write a comment.