Is it possible to track if someone printed a web page?
I think it's开发者_运维技巧 not possible, but I want to make sure.
One possible way would be to have a print CSS (<link rel="stylesheet" href="..." media="print" />
), but have a server-side script pre-process it. Basically just a simple rewrite rule to rewrite the print.css, or whatever file you use, to be proxied to a script that will log the request to some database, and then finally output the actual CSS.
Of course this isn't a perfect method; if someone uses a print preview it'll also be processed by the script.
You cannot, nothing is sent to the server when this happens, and no events are fired.
IE has onbeforeprint
and onafterprint
events you could use, but they are IE specific, so not counting them as a solution.
This would happen clientside so this is impossible. The only thing you can try is to make an easy button to print the page and simply hang a counter on that, hoping that everyone uses that button instead of the File -> Print option in the browser.
You can never positively confirm what clients do with the output from your service.
You can't.
And even if you could, Someone can even take a Screenshot of the page, Printscreen ect...
if you want to secure a content there are other ways to do it (non are totally immune)
It's not possible. Even if you could have an auto post back event which fired when someone tried to print, there is nothing stopping them from saving the HTML page to disk and printing it at a later date.
精彩评论