SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist Chromate222's Avatar
    Join Date
    May 2002
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to turn off headers and footers in IE

    Does anyone know of a way to turn off headers and footers in IE using javascript, so when someone goes to print a page they wont get the url and other stuff on the print-out?

    I know it can be done using through the browser menu. But I wanted to make it automatic so the user doesn't have to. Done a search on google and can't seem to find anything to help. Can it even be done?

    Cheers!

    Richard.

  2. #2
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Stockholm
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You cant do it with JavaScript.

    Theoretical you should be able to make an ActiveX component and by running that turning off headers and footers, but thats some helluva time to spend and not quite realistic.
    *They call us apes*

  3. #3
    SitePoint Evangelist Chromate222's Avatar
    Join Date
    May 2002
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh ok. That's a shame but I thought that was going to be the case. Thanks.

  4. #4
    SitePoint Evangelist Aska's Avatar
    Join Date
    Aug 2003
    Location
    Melbourne, Australia
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Try CSS

    This can actually be achieved using CSS. Say for example that you have the following HTML code:
    Code:
    <html>
    <body>
    <div id="myHeader">Logo etc.</div>
    
    <div>Main content blah blah blah</div>
    
    <div id="myFooter">Disclaimer link, copyright blah blah</div>
    </body>
    </html>
    And if you have these CSS directives in your internal or external stylesheet:
    Code:
    @media print {
      #myHeader {
        display: none;
      }
      #myFooter {
        display: none;
      }
    }
    ... your header and footer stuff won't be printed.

  5. #5
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe he meant the headers and footers that are added to each printed page (with the URL, date, and page title) from Internet Explorer. These cannot be controlled with CSS or Javascript (unfortunately, they can get annoying).
    Love it? Hate it? Helpful? Useless?
    Use the rate button to let me know what you think of my post!

  6. #6
    SitePoint Evangelist Aska's Avatar
    Join Date
    Aug 2003
    Location
    Melbourne, Australia
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ucahg
    I believe he meant the headers and footers that are added to each printed page (with the URL, date, and page title) from Internet Explorer. These cannot be controlled with CSS or Javascript (unfortunately, they can get annoying).
    Oops. I really should read the posts more carefully before I post. :P

  7. #7
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because such programmatic access would be open to potential abuse, this is currently not possible without a custom ActiveX component (as Arve has said). However, given what's just happened regarding IE, in the future that might not be an option either...

    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •