6

I want to change print settings of browser by javascript or CSS.
Specifically I need to clear Headers and Footers.

For example in GoogleChrome when I press Ctrl+p the print dialog appears and there is an option named "Headers and Footers" that by default has checked in my browser (Chrome version 30.0.1599.101 m).

1. I don't need a cross-browser solution. It's enough for me if I could find a solution in one browser such as Google Chrome or firefox or IE.

2. I know that this is possible by using ActiveX but I don't want to use ActiveX.

hitautodestruct
  • 20,081
  • 13
  • 69
  • 93
Mohammad Nouraein
  • 163
  • 1
  • 1
  • 8
  • 2
    Very, very unlikely without any additional browser extension. JavaScript isn't meant to manipulate browser preferences. Also, the there's no print API (and the CSS printing module is really old). After all, it's the user's choice what to print. – Zeta Oct 23 '13 at 07:11
  • see as: http://stackoverflow.com/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page – ijse Oct 23 '13 at 07:15
  • possible duplicate of [Is there a way to get a web page header/footer printed on every page?](http://stackoverflow.com/questions/1722437/is-there-a-way-to-get-a-web-page-header-footer-printed-on-every-page) – CBroe Oct 23 '13 at 07:16
  • http://stackoverflow.com/questions/2601761/change-browser-settings-by-script *duplicate* –  Oct 23 '13 at 07:21
  • thank you Zeta. but I know that CSS2+ has some controls on printer settings http://www.w3.org/TR/CSS21/page.html#page-box. – Mohammad Nouraein Oct 23 '13 at 07:25
  • thank you ijse. i read http://stackoverflow.com/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page but my problem is something else. – Mohammad Nouraein Oct 23 '13 at 07:29
  • re Cbroe -> the problem of http://stackoverflow.com/questions/1722437/is-there-a-way-to-get-a-web-page-header-footer-printed-on-every-page is other than my problem. – Mohammad Nouraein Oct 23 '13 at 07:44

1 Answers1

0

you can hide your header/footer by using css @media print querys...

w3schools

css-print-media-query

Alex Tape
  • 2,291
  • 4
  • 26
  • 36
  • thank you alex but i tested the solution that described in http://www.joshuawinn.com/css-print-media-query/ and it did not work – Mohammad Nouraein Oct 23 '13 at 07:23
  • this is really good and easy way. It works, unless your code is not correct. – ViliusL Oct 23 '13 at 09:52
  • This is assuming the OP means the Webpage body's Headers/Footer/Navigation when OP states the PRINTING Headers/Footers such as Title, Page Number, URL etc. – NSTuttle Mar 14 '17 at 18:52