Announcement

Collapse
No announcement yet.

Prevent header and footer from showing when printing a webpage

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Prevent header and footer from showing when printing a webpage

    Evening all,

    When you print a webpage, the browser tacks on the title, URL, "page x of y" and the timestamp. I know how to disable this in the browser options, but does anyone know of a way to get the website to do this using JavaScript or some other means? I only want this to be removed from one page in particular if possible.

    Long term I'll be looking to generate a PDF to overcome this, but the system I'm currently working on is just a functional prototype with a very tight deadline.

    Target browser is IE 8. If it makes a difference, the app is written in JSTL 1.0 and being served by Tomcat 6.

    Let me know if you need any more info and TIA
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

  • #2
    Re: Prevent header and footer from showing when printing a webpage

    I do not know if this will help, but there are 2 parts to this, one, setting the print area, and then setting the header for this error.

    http://www.htmlgoodies.com/beyond/cs...d-Printing.htm
    Shows the use of page brakes in CSS to create custome header info for a section of text.

    http://www.webmasterworld.com/forum83/7411.htm
    Shows different ways to use CSS and HTML to hide, do not display, or do not print different sections of HTML using different methiods.

    http://www.w3schools.com/CSS/css_mediatypes.asp
    Shows how to set display options for your website when it prints, as well as other things.

    Sorry I was not able to give you a single nice line of code, but its abit complicated, and it depends on what your doing as to what the best format is.

    I have used all of these methiods before to achive a similer goal, so if you need any more help, please let me know.

    Wofen
    Good to be back....

    Comment


    • #3
      Re: Prevent header and footer from showing when printing a webpage

      As I understand it, the second and third links talk about printing and formatting parts of the webpage, whereas the first seems to be about forcing the browser to print a page when loaded. The header and footer that I'm referring to are generated by the browser, not the website
      Gareth Howells

      BSc (Hons), MBCS, MCP, MCDST, ICCE

      Any advice is given in good faith and without warranty.

      Please give reputation points if somebody has helped you.

      "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

      "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

      Comment


      • #4
        Re: Prevent header and footer from showing when printing a webpage

        Any use?
        http://www.irt.org/script/1437.htm
        Tom Jones
        MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
        PhD, MSc, FIAP, MIITT
        IT Trainer / Consultant
        Ossian Ltd
        Scotland

        ** Remember to give credit where credit is due and leave reputation points where appropriate **

        Comment


        • #5
          Re: Prevent header and footer from showing when printing a webpage

          That does indeed look useful I've already got a cover page before the main report body, so it wouldn't cause a problem having the "Print" link on there. Besides which I could probably hide that with CSS.

          Cheers
          Gareth Howells

          BSc (Hons), MBCS, MCP, MCDST, ICCE

          Any advice is given in good faith and without warranty.

          Please give reputation points if somebody has helped you.

          "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

          "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

          Comment


          • #6
            Re: Prevent header and footer from showing when printing a webpage

            It appears to require an activeX to be installed too
            Tom Jones
            MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
            PhD, MSc, FIAP, MIITT
            IT Trainer / Consultant
            Ossian Ltd
            Scotland

            ** Remember to give credit where credit is due and leave reputation points where appropriate **

            Comment


            • #7
              Re: Prevent header and footer from showing when printing a webpage

              Ah yes. Still a possibility though. When I have more free time I'll play around with generating PDFs.
              Gareth Howells

              BSc (Hons), MBCS, MCP, MCDST, ICCE

              Any advice is given in good faith and without warranty.

              Please give reputation points if somebody has helped you.

              "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

              "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

              Comment

              Working...
              X