Wednesday, December 16, 2009

Simple way to prevent printing of web page

Basically, there is no way to prevent a user who really wants to print a web page out, it is a simple as them hitting their "Print Screen" button, etc...

But for intranet purposes, letting your users know that some pages are not to be printed, you can add the following code to the head section:

{{Code is changed slightly by removing "<" in front of tags for display here:}}

head>
style type="text/css" media="print">
body { visibility: hidden; display: none }
/style>
/head>

This will only print out a blank page when the user goes to "file"--> "print" (print conventionally)

A user can still print out by unconventional methods but, by doing so, is understanding the company does not want it printed, and he is behaving improperly.

No comments:

Post a Comment