Printing in IE8 Has @href contents inline

2019-07-18 17:47发布

问题:

Can someone tell me how to stop IE8 printing the value of the href for an A tag next to the text. For example this markup

<a href="/site/page.html">Some Link</a>

When printed comes out as

Some Link(/site/page.html)

when printed. How can I stop this?

回答1:

This doesn't happen for me in IE8 and I've never spotted it. I also can't find it in the Internet Options anywhere.

It is possible that you have some software on your computer that does this, for example AVG Anti-Virus adds content to web pages to tell you that it has checked the links being displayed for potentially harmful content - so your system-security software may be expanding all links to show you where they actually point, to prevent phishing attacks.

If you do have some anti-phishing software on your machine, you'll have to find the option within that.

Update - It is almost certainly some clever CSS.

I have created the following test page to demonstrate how you can add the URL to a link using CSS generated content. If this was used within a print stylesheet, this would explain how the URL is getting added to the link when you are printing the page. To stop this, you would have to save a copy of the web page, remove the style rule from the print-only style sheet and then open your copy and print it!

<html>
<head>
<title>Test</title>
    <style type="text/css">
    a:after {
        content: " [" attr(href) "] ";
    }
    </style>
</head>
<body>
    <h1>Test</h1>
    <p>This is a test to see if this 
    <a href="http://www.stevefenton.co.uk/">Link Shows A URL</a></p>
</body>
</html>