In my web application there is a page such as /article/id. I already add a "print" link on this page, so when user click print link he will be linked to a print friendly page called /article-print/id. The print friendly page use a little different content and totally different css.
This works fine.
But when a user view /article/id web page and he click the browser's print button (file/print or ctrl+P) instead of my print link, the printer will print /article/id page. This is not what I want.
Is there something I can do to make clicking browser's print button redirected to other page just like /article-print/id?
I know a similar method which is adding a
<link rel="stylesheet" type"text/css" href="print.css" media="print">
into /article/id page. So when browser's print button is clicked, the browser will use print.css to render the print page.
Also this is not what I want. I think since I have already had a print friendly page /article-print/id, can I just redirect print button to it?
Thanks.
You cannot redirect or redefine the browser's print button. That would be a security hole, if you could.
You can use print CSS (the best way) or you can offer your own print button and hope that the user decides to use it (she won't always).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With