Subscribe To RSS

If a webpage gets printed the browser automaticaly adds a header/footer. How can this be hided without ActiveX

Written by ScriptInstaller on April 2nd, 2009

zoernert asked:

If a webpage gets printed the browser (esp. InternetExplorer) automaticaly adds a header and a footer. So far I know that this header and footer can be modified via the registry or via an ActiveX component (ex. http://www.htmlprinting.com/).

My question:
Is it possible to hide the header and footer with Style-Sheets, JavaScript or other Script that does not require a Client-Side installation or modification?
Addition:
The target is to print from a website without having the user to modify the system. That means that I want to render for example an invoice and allow the user to print it (wihout header and footer – added by the browser).


Related Blogs

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • NewsVine
  • Reddit
  • StumbleUpon
  • YahooMyWeb
  • Google Bookmarks
  • Yahoo! Buzz
  • TwitThis
  • Live
  • LinkedIn
  • Pownce
  • MySpace

Tags: , , , , ,

3 Comments at "If a webpage gets printed the browser automaticaly adds a header/footer. How can this be hided without ActiveX"

Anonymous April 3rd, 2009 (#)

WHOA ,I usually highlight what I want to print and go from there

Anonymous April 6th, 2009 (#)

your question is not clear…don’t know why you are talking about active X, java script etc…the simple way is to copy the portion you want by right clicking and choosing the portion you want and paste it in a word document and print it

Anonymous April 6th, 2009 (#)

CSS is the best way to go. Let’s assume you have a file called “print.css” and your header and footer are in DIV tags with the ids “header” and “footer”, respectively. Then you can put this on your page:

And put this in print.css:

#header, #footer {
display: none;
}

The #header and #footer divs will automatically be hidden when the user tries to print. (Wikipedia is a great example of this)

Good luck!

Edit: If you’re referring to the page number and web address that get printed at the top/bottom of every page, the only way to remove that is in the File > Page Setup on each client machine.