Take the 2-minute tour ×

I am working on a page which will have an area at the bottom listing out groupings of FAQs with a few different tab levels and then questions which can be expanded/collapsed by the user. We want to provide a way for the user to be able to nicely print

  1. Just the questions/answers they have expanded
  2. All the questions/answers in the sub-group they have selected
  3. All the questions/answers in the primary group they have selected
  4. All the questions/answers on the page

The plan is to have a drop down box with a print button (unhidden by Javascript) that would apply a class that when clicked that would hide the other content on the page and give us the display we want for the user selected option. This is all easy enough to do and we can apply a default print-style using #4 as a catch-all when javascript is disabled which can just be triggered via the normal print mechanism.

The problem is how to remove that special style when the printing is done so that if the user were to go and click the browsers print button, they get what they expect a print out of the whole page instead of the last selected "special" print view.

I have thought up a few potential solutions but I am not entirely happy with any of them:

  1. We could replace our planned in page print with a link to another page which formats itself without interfering with the rest of the page content. I don't like this idea because it breaks the page into pieces and if possible I always prefer to keep the user on the page.
  2. We could set a timeout when the print button is clicked to remove our special class after some period of time bringing the page back to a default state. I don't like this because it will produce unpredictable behavior from the user's point of view. If they take "too long" printing the first time they don't get the style they want. If they print the whole page "too quickly" after the special print they get an odd result
  3. We can use the after-print trigger in IE to remove the style for those users, but as far as I can tell this sollution is only an option in IE and leaves all the other browsers in the cold.
  4. We could make a general assumption that a user is very unlikely to come to the page and do a special formatted print followed by a desire to print the entire page and just let is go at that.

Any other solutions anyone can think of?

share|improve this question
add comment

1 Answer

Your first solution is actually very good if you use target="_blank". This would keep the user on the page but avoid all the other problems.

However, I think the whole problem is moot if you make the page layout match the dropdown. In other words, if they're looking at Section 2, Subsection 3, Question 1, and they select "print all questions in subsection", just expand the subsection and open the print dialog box. Then you only have to worry about setting a single class (noprint) and apply it to everything else.

share|improve this answer
The first solution would work certainly I just don't like the whole pop-out method of printing. As for having the display match the print it isn't necessary to do it as the print media type gives me all the flexibility I need. That is what the print stylesheets are for and I don't think we need to break any of the normal display. If we did a pop-up then it would make sense to show the "true" print view but not otherwise. –  lostatredrock May 5 '11 at 16:14
add comment

Your Answer


