How to Remove URL from Printing the Page ?

When you print a Web page from your Web browser, you’ll notice that the printout contains some extra pieces of information like the page number, the date and the web page’s URL at the bottom of the page. Some times you may not need this information in your printout in order to tidy up your work.
So here are a few methods that let you print web pages without the extra information appearing at the bottom of the page.

There are two approaches through which we can achieve this.



  1. Programatical Approach: Here are few simplest ways of doing it.
    Example 1:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    @page {
        size: auto;
        margin: 0;
    }

    chevron_right

    
    

    Example 2:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    @print {
        @page :footer {
            display: none
        }
      
        @page :header {
            display: none
        }
    }

    chevron_right

    
    

    But there may occur some issue on browser due to which the above code does not work. So the following code can be used to overcome browser issues.

    Example 3:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    @media print {
        @page {
            margin-top: 0;
            margin-bottom: 0;
        }
        body {
            padding-top: 72px;
            padding-bottom: 72px ;
        }
    }

    chevron_right

    
    

  2. Browser side Approach: There are the steps to disable the header and the footer in a browser.
    • Internet Explorer: Go to the File menu and choose Page Setup from the drop-down menu and click the menu that displays URL in the Headers and Footers section and select “-Empty-” from the menu.
    • Mozilla Firefox: Go to the Page setup option from the file menu and click the Margins & Header/Footer tab. Change each value under Headers & Footers to --blank--.
    • Google Chrome: Go to the Menu icon in the top right corner of the browser and Click on Print button. Uncheck the “Headers and footers” option underneath the “Margins” option.
    • Apple Safari: Go to the print option from the menu and the Print dialog appears. Uncheck the “Print headers and footers” option.
    • Literally, in all the browsers, do the same following case to remove the header and footer part.

Sample Output:

  • When Url is visible:

    Also, note that the headers and footers box is checked.
  • When Url is removed:

    Note that the headers and footers box is unchecked.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.