0

I have a problem where the link locations are being printed when the user prints. Is there a way to disable the locations from being printed?

For example if I have the following code

<div id="link_row" class="headerbar"><a href="admin.aspx">Home</a>

it will print Home (admin.aspx)

or on other links Link1(javascript:Do_something()) when I only want to print Link1

Is there something that I can do to avoid such a problem?

Print a website without printing the link locations?

I looked at the link above to, but I am not able to follow the solution there.

Thank you,

Varun

EDIT: Just to clarify that this is occuring across all users with IE 8 or Firefox 3.6.

Community
  • 1
  • 1
Varun Dave
  • 179
  • 1
  • 2
  • 12
  • Does your site have a print style sheet? Usually you have to explicitly add the functionality you are reporting. Does this happen for all users on all browsers? – nikmd23 Jun 29 '11 at 15:49
  • Yes it does use a print style sheet and it occurs across Firefox and Internet Explorer 8 and Firefox 3.6. Also, I do not want the the bracketed text to show and which elements can I use to add the functionality? – Varun Dave Jun 29 '11 at 15:52

1 Answers1

3

asp.net-mvc includes a default print stylesheet. It uses a CSS pseudo-elements to add the value of the href into the visible html. Css-Tricks has a good article on this trick and others.

You should find the CSS selector in the default print stylesheet (probably similar to "a[href]:after"), then add that same selector to your own print stylesheet, and make it override the original, which may require using !important.

@media print {
  a[href]:after { content: ""; }
  }

or, if that doesn't work:

@media print {
  a[href]:after { content: "" !important; }
  }
jwl
  • 10,268
  • 14
  • 53
  • 91