开发者

Prevent printing url while window.print

开发者 https://www.devze.com 2023-03-15 18:35 出处:网络
I am using javascript window.print(); to print web-page. On printout, it is sh开发者_如何学JAVAowing url like http:\\...

I am using javascript window.print(); to print web-page. On printout, it is sh开发者_如何学JAVAowing url like http:\...

How i could avoid it?


You can't control this in javascript, it has to be done at the browser level.

This post explains how to do it in Firefox and IE http://www.howtogeek.com/howto/the-geek-blog/prevent-firefox-or-internet-explorer-from-printing-the-url-on-every-page/

What we have done in the past is just have a link explaining to the user how to do this for their browser.

EDIT

What we've also done is generate a PDF so that you can make the page look the same across all browsers. iTextSharp is a free tool to do this. Just a note, it is kinda unfriendly. There is an example here. Basically, you input HTML and it converts it to a PDF.


Add a title. It overrides the url

<head>
    <title>My title</title>
</head>
0

精彩评论

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