html print page
I want to print some HTML content, when the user clicks on a button. Once the user clicks on that button, the print dialog of the browser will open, but it will not print the webpage. Instead, it will print the some other HTML content which is not displayed on the page.
While asking this question, there are few solutions coming into my mind. But I am not sure whether those are good ideas or something better can be done. One of those solutions are: I can keep this HTML content in a div and make it display: to print, but display: none to screen. All other elements on the webpage can be made to display: none for print and display: for the screen. And then call to print.
Add the following HTML and JS code to your website or blog:
Companies and individuals are doing great efforts to print less and “go green”. However, as a web developer, you may still want to add a print option on your website. Printing out a webpage is still often used on some types of website, so offering an easy to use button or link is a good practice for your visitors.
Another way to prevent getting this page in the future is to use Privacy Pass. You may need to download version 2.0 now from the Chrome Web Store.
If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.