javascript 如何在 Firefox 打印时隐藏 web url

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15585594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:18:02  来源:igfitidea点击:

How to hide web url on print for firefox

javascriptcssfirefox

提问by irror

When I print a webpage from Firefox, it automatically adds a header and footer including the website title, URL, date, and page number.

当我从 Firefox 打印网页时,它会自动添加页眉和页脚,包括网站标题、URL、日期和页码。

I previously looked at this question for IE and Operaand this question, but I need to remove the header/footer specifically in Firefox.

我以前查看过IE 和 Opera 的这个问题以及这个问题,但我需要专门在 Firefox 中删除页眉/页脚。

Is it possible to hide the header and footer programmatically using JavaScript or CSS?

是否可以使用 JavaScript 或 CSS 以编程方式隐藏页眉和页脚?

回答by

If you are using firefox do the following :

如果您使用的是 Firefox,请执行以下操作:

Go to the 'File' --> 'Page Setup' item on the menu, and then select the 'Margins & Header/Footer' tab in the dialog.

转到菜单上的“文件”-->“页面设置”项,然后在对话框中选择“边距和页眉/页脚”选项卡。

enter image description here

在此处输入图片说明

you should be able to change the drop-downs to set the Title or URL to –blank– instead, which will prevent them from printing. Note that you could also use this to put the page numbers at the top instead of the bottom if you prefer that. This was the normal approach to print without headers/url in general

您应该能够更改下拉列表以将标题或 URL 设置为 –blank–,这将阻止它们打印。请注意,如果您愿意,也可以使用它来将页码放在顶部而不是底部。这是一般没有标题/网址的正常打印方法