Print a website without printing the link location

2020-02-08 23:36发布

I'm invoking the navigator print function using a simple window.print(); call. It prints perfect (I want to print the same I see on the screen, so I don't really use a special CSS to print) but it showing the link locations next to the text link, something like:

    Homepage (http://localhost)

To be clearer: I don't want to have the link locations near the links in the printed version, I have control over the CSS but I can't find this behaviour defined anywhere, so I think is a navigator-related issue!

EDIT: This happens under Firefox 3.6.8 and the last Chrome, on Ubuntu an Windows XP/Vista.

13条回答
做自己的国王
2楼-- · 2020-02-09 00:11

I faced the same problem, if you're using chrome, the trick is when displaying the print window, this one contains a left config panel which gives some configuration of display mode and other, there is a link below named : more params or more config (I had in french so I tried to translate it ), click on it after that it will show some additionnal options, among them, there is a check box "header and footer" uncheck it, and it will hide the "localhost...." hopefully it will help

查看更多
冷血范
3楼-- · 2020-02-09 00:11

Every browser having setting of printing header and footer ,and background graphics If you disable this setting of printing header and footer then it will not show on your print page

查看更多
smile是对你的礼貌
4楼-- · 2020-02-09 00:12

While many css options have been suggested, if you wish to get rid of the links and headings in the header/footer which is forced on each page, there is a setting just for you. As shown below.

Remove Footer Links in Chrome Print View

That's it.

查看更多
姐就是有狂的资本
5楼-- · 2020-02-09 00:13

For anyone using Bootstrap 3, the selector used is:

a[href]:after { }

And can be overriden with something like:

a[href]:after {
   content: initial;
}
查看更多
Melony?
6楼-- · 2020-02-09 00:14
等我变得足够好
7楼-- · 2020-02-09 00:16

I found the other solutions don't work (anymore) cross-browser. The following works in FF 29, Chrome 35, IE 11:

a:link:after, a:visited:after {  
  content: normal !important;  
}
查看更多
登录 后发表回答