最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there any way to change Browser print settings by Javascript or CSS - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question edited Oct 23, 2013 at 9:50 hitautodestruct 20.9k14 gold badges75 silver badges95 bronze badges asked Oct 23, 2013 at 7:04 Mohammad NouraeinMohammad Nouraein 1631 gold badge1 silver badge8 bronze badges 7
  • 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 Commented Oct 23, 2013 at 7:11
  • see as: stackoverflow./questions/1960939/… – ijse Commented Oct 23, 2013 at 7:15
  • possible duplicate of Is there a way to get a web page header/footer printed on every page? – C3roe Commented Oct 23, 2013 at 7:16
  • stackoverflow./questions/2601761/… duplicate – user2822316 Commented Oct 23, 2013 at 7:21
  • thank you Zeta. but I know that CSS2+ has some controls on printer settings w3/TR/CSS21/page.html#page-box. – Mohammad Nouraein Commented Oct 23, 2013 at 7:25
 |  Show 2 more ments

1 Answer 1

Reset to default 1

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

w3schools

css-print-media-query

发布评论

评论列表(0)

  1. 暂无评论