Hide header and footer when printing from Internet Explorer using Javascript or CSS

29,168

In your print options you can disable this. The only way to do it programatically is with an activeX control which writes to the registry or a script block which is written in VB. The settings for your print options are stored in the registry. The user would have to allow your script to access the registry which most people wouldnt because of security.

If you want to control page content, you can use a css print stylesheet.

Edit: There are 3rd party active x controls which can programatically print for you, but once again, the user would have to choose to download and install it.

Share:
29,168
mrmaan4u
Author by

mrmaan4u

Senior Analyst Programmer Currently working with AngularJS and TypeScript Previous experience with C#, Lotus Domino, Java, and Python

Updated on July 31, 2022

Comments

  • mrmaan4u
    mrmaan4u almost 2 years

    When I print a webpage from Internet Explorer it will automatically add a header and footer including the website title, URL, date, and page number.

    Is it possible to hide the header and footer programatically using Javascript or CSS?

    Requirements:

    • works in IE 6 (no other browser support necessary as its for an Intranet)
    • may use ActiveX, Java Applet, Javascript, CSS
    • preferably not something that the user needs to install (eg. http://www.meadroid.com/scriptx). feel free to list other third party available plug-ins though as I think this may be the only option
    • don't require the user to manually update their browser settings
    • don't render the pages as PDF or Word document or any other format
    • don't write to the registry (security prevents this)

    Thanks

  • Gavin
    Gavin over 15 years
    D'oh, someone clearly didn't read the entire question properly lol
  • tishma
    tishma over 13 years
    Telerik Reporting sends the data for printing as PDF and somehow launches PDF reader's (also an Active X/3rd party component) print feature.
  • CRice
    CRice almost 9 years
    Got any more info on the activeX, registry locations or script block?
  • CRice
    CRice almost 9 years
    In IE8, headers and footers can be emptied in "File -> Page Setup"