PDA

View Full Version : "Print" links and users without Javascript.



jlizarraga
02-12-2009, 11:08 PM
Hi all,

How do you handle "print this page" links for users without Javascript?

I was thinking a good option would be to have the HREF for the link be to a page explaining how to enable Javascript.

Does Javascript affect a print CSS file? Users without JS enabled still get the print CSS, right?

Thanks!

EDIT: "how do you" meaning you personally, on your own projects. I know users without JS have to use File > Print. :P

smansakra
02-13-2009, 04:36 AM
i just know this


<a href="javascript:void(0);" onclick="if(window.print) window.print();return false;">Print</a>

codeexploiter
02-13-2009, 11:02 AM
I don't think the printing can be achieved without using JS. Of course the user will be able to print it through the File -> Print option in the browser window.

There are certain things that can not be achieved without using programming.

jscheuer1
02-15-2009, 04:34 PM
What I do is first assume that anyone without javascript enabled who is wanting to print a page will know how to do so. Second, I code all my print this page or print whatever links and buttons in javascript, so that they aren't even seen by non-javascript enabled browsers.

The only pages that I'm all that concerned with folks printing are things like schedules or directions. If I give them a link to a printer ready page, they will get the idea with or without javascript enabled. Sometimes I just make it easier for the javascript enabled folks though.

Finally, yes - even without javascript enabled, your print css will still be in effect.

Falkon303
02-16-2009, 07:51 AM
If you are using php as well, you can also always utilize the pdf lib, and allow them to save as a pdf as a nice alternative.

http://www.digitaljunkies.ca/dompdf/examples.php#demo