disabling Print option in browser ?

P

paul814

Is it possible to disable the print option under file and also the
ctrl-p option on a specific page?
 
E

Evertjan.

wrote on 05 dec 2007 in comp.lang.javascript:
Is it possible to disable the print option under file and also the
ctrl-p option on a specific page?

<body onbeforeprint="while (true) alert('No printing allowed!')">
 
P

paul814

Or if you want something cross browser and not quite so drastic:
<style type="text/css">
@media print {
BODY { display: none !important;}}

</style>

It is still easily defeatable, but should be effective in persuading users
to go elsewhere.

Well it is not that I want users to go elsewhere, just that this page
will have a big report on it and I don't want them to print the who;e
thing, about 50 pages worth. I rather they use the View by date
option I have set up and only print the date(s) that they want.

But I did try this:
<style type="text/css">
@media print {
BODY { display: none !important;}}
</style>
And it had no effect. I was still able to do a file print.
 
D

David Mark

Well it is not that I want users to go elsewhere, just that this page
will have a big report on it and I don't want them to print the who;e
thing, about 50 pages worth. I rather they use the View by date
option I have set up and only print the date(s) that they want.

Why would you care what your users print? It's their paper.
But I did try this:
<style type="text/css">
@media print {
BODY { display: none !important;}}
</style>
And it had no effect. I was still able to do a file print.

You will find that it does have an effect if you click the print
button on the dialog (i.e. it will print a blank page.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,147
Messages
2,570,833
Members
47,380
Latest member
AlinaBlevi

Latest Threads

Top