Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    214
    Thanks
    4
    Thanked 0 Times in 0 Posts

    How to make automatic opened print window?

    I have used code to publish article on website with link to print.

    When there is clicked link it will open printer friendly page with link to print this page. I used code which works:
    PHP Code:
    <a href="print.php?printable=true" onClick="window.print()" target="_blank">Print firendly page</a
    Article page has redirection to print friendly page:
    PHP Code:
    <a href="print.php?printable=true" target="_blank">Print firendly page</a
    This works but I have to click on link. I need also option to open print window automatic as soon there is clicked on print link within article page but it should be printed print firendlyl page.

    How to do it?

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    On the page that is to be printed:

    Code:
    <script type="text/javascript">
      window.onload = function{ window.print(); }
    </script>
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •