Forum Moderators: open

Message Too Old, No Replies

How do you print all pages in a website?

         

smithaa02

7:25 pm on Nov 24, 2008 (gmt 0)

10+ Year Member



Basically what I want is one link that when you click it will print everypage on the website. The paths to to pages could be hardcoded on my end, I just don't know how to setup the javascript to do this. Any ideas?

dreamcatcher

8:37 am on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Its not possible to print all your web pages in one go using JS. The JS print command is for the current page only. Your best bet is to have a pop up or something that loads all your page content on a single print friendly page.

dc

smithaa02

2:42 pm on Nov 26, 2008 (gmt 0)

10+ Year Member



What about using frames?

Trace

8:19 pm on Nov 26, 2008 (gmt 0)

10+ Year Member



Frames would work, in theory. You could have a 1x1 iframe that contains all the content and when your print link is clicked, switch the focus to the frame and call the print function.

In practice however, the frame needs to be on every page that has the print link, which I am assuming is all of your pages. So every time a page is loaded, so would the frame with all it's contents. Depending on how much content you have, that could make your pages extremely slow to load.

Is it really worth it?

Another option is loading all the content into a DIV and hiding it via CSS and in turn displaying it via the @media print type. Again you're faced with the bloating issue.