Re: No JavaScript for previous page and print screen

On Thu, May 22, 2003 at 08:19:19AM +0930, Matthew Smith wrote:

> To use your "back button example":
> 
> # We get a value from the (already defined) CGI object, $q
> my $referer=$q->referer;
> 
> print "<a href='$referer' title='Return to the previous page.'
> 	>Back</a>";

  May I take this moment to remind us all that the HTTP Referer
 header is optional, and may - for privacy reasons - not be sent
 by users. An alternative snippet (still assuming the use of
 CGI.pm *cough*)

   my($referer) = $query->referer() || 'http://www.server.domain' ;

  for this situation.



> As regards printing, you're really stuck with the JS window.print() 
> function for printing plain HTML.  However, HTML isn't the most 
> print-friendly medium, nor do I believe was it designed to be.  If you 

   HTML isn't printer-friendly, no; nor is it really friendly to any
  medium at all. Remember that HTML is simply the structure. For more
  control over how HTML MAY be printed, I strongly suggest looking into
  the use of printer-specific CSS files. Easy, fairly well supported,
  and accessible.

   The alternative would be to use a tool such as html2ps and generate
  Postscript.


-- 
 - Tina Holmboe

Received on Thursday, 22 May 2003 06:04:39 UTC