Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.Print shows URL from link on page

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
US
How do you get window.print() to not print the url of an anchor tag?

I have the following in my page:

<a href="../Views/Home.aspx" style="text-decoration : none; color : #000000;">
<img src="../Images/logo.png" alt="logo" id="logo">
My Company
</a>

This just shows the logo and "My Company" on my screen but on my printer it shows the logo, "My Company" and "(../Views/Home.aspx)".

How do I get the printed version to not show the url?

Thanks,

Tom
 
Printers do not 'know' how to handle a "linked" image so they do the best they can.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Which OS and browser are you using to print?
Chrome has the option to turn on/off header and footer
IE offers to customize the header and footer in page setup.

Bye, Olaf.
 
Olaf said:
Which OS and browser are you using to print?
I get the impression it is the other visitors to the 'page' that the OP wants to control printing for.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
I have the same impression, but knowing where this is influenced you can easier deduct this is nothing you can control in your HTML. It's a per Browser and/or OS behavior and the user/visitor can influence that. I wonder whether CSS can influence what header/footer a printed page has, it only influences the HTML page look itself.

If you want control of the printed HTML page, I'd use some service generating PDFs from a page and offer that as download for printing, eg
Bye, Olaf.
 
I am not trying to turn off any headers or footers. I can do that fine.

I don't want to turn off the header. The anchor has our logo in it, as you can see from my first post and we want to print that (the image) - so I can't hide the anchor.

My problem is that in a browser the link address is not shown - just the text. If you print the page directly (print button from browser) it prints correctly - without the link's url. But if you try to use windows.print() - it prints the url and that is what I am trying to prevent.

In this case, I am using IE 10.

Thanks,

Tom
 
I don't think this is a bug or feature of IE. CSS might cause this printing behavior, eg a[href]:after { content: " (" attr(href) ")"; }

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top