Forum Moderators: open

Message Too Old, No Replies

Printing pages neatly in firefox.

         

gpmgroup

7:17 pm on Jun 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



we use the following command in IE to print a nicely formatted page (sans menus, background graphics etc.)

<LINK REL=alternate MEDIA=print HREF="print/filename.html">

In Firefox it doesn't seem to work is there an alternative command or a different syntax?

BlobFisk

7:53 am on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think that this is the cause of the problems but you seem to be missing the type attribute on your link tag:

<LINK REL=alternate MEDIA=print HREF="print/filename.html" type="text/html">

Maybe your best and most cross-browser compliant option here is to use a CSS print stylesheet for the printed version of your page:

<link rel="stylesheet" type="text/css" media="print" href="print/filename.css" />

By using 2 seperate pages you need to maintain the content of 2 documents instead of just one.

tomda

8:07 am on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are right, from what I have seen, the alternate Media print command works in IE but not in FF.

As suggested, you better use stylesheet for clean printing.
Make a printer friendly link to your page which call the external stylesheet (print.css) and have a javascript command on the body tag (<body onload=print()>). The popup will open and the printing box will appear at the same time.

If only use HTML, then you need to deal with two pages.

If you know bit of PHP, then the use of a print variable is great to change the layout (using if statement) and changing the external CSS file.

My 2cents

gpmgroup

9:39 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for help :)