开发者

In Firefox, when printing a page with anchor tags, the link location is printing after the text

For example,

<a href="../somepage/page.aspx?qs=asdf">Text Here</a>

will print out as...


Text Here(../somepage/page.aspx?qs=asdf)


In IE, it looks normal (doesn't print the url). Any id开发者_高级运维eas why this is acting in this fashion?


Extrapolating from Brett's answer, on Firefox 25, this CSS style removes the offending href:

@media print {
    a:link:after,
    a:visited:after {
        content: "" !important;
    }
}


Also, if you're using Twitter Bootstrap as a framework, this:

a[href]:after{
    content:"";
}

... will do the trick! (at least in bootstrap 3)


The answer was in the css framework we are using (Blueprint). There was the below line in the style file:

a:link:after,a:visited:after{content:"(" attr(href) ")";font-size:90%}

Guess this might help others who use Blueprint.


If you want to to be more specific - say remove links within a table, then you could do the following with jQuery.

$(".tableclass tr td a").removeAttr("href");


Just add this in your layout page (Master Page)

a[href]:after {
        content: none !important;
    } 


There is also the semantic reason to print the url next to the link. Imagine you print the document without the url. You cannot be sure to completely understand the text as it is meant by the author.

It can be necessary for a quote to print the source as well. That is important i.e. for academic texts.

Indeed Bretts answer is correct.


You can avoid this problem altogether on the screen by including the media attribute on the print style link as follows

<link href="../../Content/blueprint/print.css" rel="stylesheet" media="print" type="text/css" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜