Reputation: 11571
I need to know all options to disable the native Firefox Print Dialog on a Website.
Assume the Stack Exchange don't like that the users are able to print the privacy policy by the File > Print option.
Therefore it should be possible to add JavaScript that deactivates this option. Something similar to the technique some websites are using to "disable" right-clicks on images.
Is this possible?
More Background:
It's not the case that i like to do it. I have to validate that my customers are not doing ugly stuff like this on their websites (more then 1000 websites).
Upvotes: 0
Views: 127
Reputation: 664433
It is absolutely not possible with JavaScript to access such things - the Print-Dialog is native and not to be disabled. Even if it were possible, one could just disable JavaScript.
A much better alternative is to use CSS. Most browser apply the print
stylesheets when they are to print the current page, so you could include something like:
@media print {
body { display:none; }
/* or */
#box-that-tells-the-reader-there-is-nothing-to-print { display:block; }
.print-hide-information { visibility:hidden; }
}
Of course one could remove that CSS code from the DOM, or just take a screenshot of his browser etc. Whatever files you send a user to view, he will be able to save them - you can't prevent that. Your only possibility is to build a proprietary reader/viewer for your encoded contents to constrain the user (which could get hacked, too), but that is no option on the open web.
Upvotes: 1