Removing page title and date when printing web page (with CSS?)

后端 未结 7 723
一个人的身影
一个人的身影 2020-11-29 01:31

By default, when you print a web page, the page title and and URL are printed at the top of the page, and likewise the date

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 02:12

    A possible workaround for the page title:

    • Provide a print button,
    • catch the onclick event,
    • use javascript to change the page title,
    • then execute the print command via javascript as well.

    document.title = "Print page title"; window.print();

    This should work in every browser.

提交回复
热议问题