1

I need to print a webpage. I use this javascript function to print it.

function myFunction() {
    window.print();
}

I see html title and date at the top and the page url at the bottom. I don't want these to see on my print and tried to find a fix for that but no luck. Any advice is highly appreciated.

Ajith
  • 639
  • 6
  • 21
  • 1
    Usually hiding that type of info is hidden by the user in the print dialog. This might help you though: http://stackoverflow.com/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page –  Mar 25 '16 at 02:07
  • use a print style sheet – albert Mar 25 '16 at 02:25
  • Disabling that in Javascript, it is not possible. You could set the page title to an empty string but the URL is not able to be removed programmatically. – Torchify Mar 25 '16 at 02:25
  • @albert I'm using a print stylesheet, but didn't get a way to hide those stuff by css. don't know class or id ( selector ) for those. Any idea ? – Ajith Mar 25 '16 at 04:10
  • @Torchify If I set title to empty, it displays the url at the place where title prints. But I need to remove date etc as well. Or if I could modify those, that also helps – Ajith Mar 25 '16 at 04:14
  • @albert yes, that works. But it removes margins. But I need some margins too. Thank you for your prompt reply – Ajith Mar 25 '16 at 05:51
  • you can add the margins with that style sheet. sorry, gonna recommend this as duplicate – albert Mar 25 '16 at 14:18

1 Answers1

2

The date, title, and URL are part of the browsers print setting which can only changed locally by the user. You may want to consider creating a PDF output of your page. You would be able to format that completely how you want.

Issa
  • 321
  • 2
  • 6
  • I'm looking for a way to modify/hide them using css or javascript or ( programatically) but not using browser print setting. Thanks for your answer – Ajith Mar 25 '16 at 04:15