I need to disable the print function on certian pages on my site. It is an intranet and I have all the pages that need no printing in its own site. I need to disable on the pages on one site and allow the to print on another.
There might be an easy way to do this but I don't know any. What you could do would be to use media style sheets. Do something like - have all your code in a div and use a print media style sheet to hide the div. That way, when someone tries to print the page, all that will print will be an empty page.
You could also have a second div that contains a message - "You do not have permission to print this page". Set up two media styles. Screen view will show the first div and print view will print your message.
I have this working on one of my pages as follows:
<STYLE>
@media print {
#screenView {display: none;}
#printView {display: block;}
#TOP {display: none;}
#BOTTOM {display: none;}
}
There might be an easy way to do this but I don't know any. What you could do would be to use media style sheets. Do something like - have all your code in a div and use a print media style sheet to hide the div. That way, when someone tries to print the page, all that will print will be an empty page.
You could also have a second div that contains a message - "You do not have permission to print this page". Set up two media styles. Screen view will show the first div and print view will print your message.
I have this working on one of my pages as follows:
<STYLE>
@media print {
#screenView {display: none;}
#printView {display: block;}
#TOP {display: none;}
#BOTTOM {display: none;}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.