In my asp.net application i just tried to print a webpage using java script, no problem i got it. I used the function window .print. But the page url also printed,how to remove the url while printing the page.?
Asked
Active
Viewed 582 times
1
-
The url in the header/footer? Pretty sure you can't – slinky2000 May 22 '13 at 11:29
-
Maybe a duplicate of http://stackoverflow.com/questions/10090981/javascript-print-without-url-and-date? – Christopher May 22 '13 at 11:29
-
Also Maybe a duplicate of http://stackoverflow.com/questions/585254/how-to-remove-the-url-from-the-printing-page – slinky2000 May 22 '13 at 11:30
-
I don't think you can using JavaScript - that would be a security issue, albeit a minor one. I believe that it's the browser that prints the URL/page number as the header and footer, so that would be why. – Qantas 94 Heavy May 22 '13 at 11:31
-
2@Frederik.L: why meta? – Qantas 94 Heavy May 22 '13 at 11:32
-
okey...then which one is the best case to print a page ...? – raneena May 22 '13 at 11:34
-
@raneena What everyone is trying to tell you is that it cannot be done on the client side ie. you cannot use javascript to print without headers and footers on the client's machine since it is the browser which controls how the printing is done. – hanut May 22 '13 at 11:37
-
@Qantas94Heavy The question is about configuring a printer, as `window.print` doesn't do anything but call the default printing action, therefore I think it suits better on meta. Unless, the OP wants a way to access printer settings with javascript, which doesn't make sense. – Frederik.L May 22 '13 at 11:37
-
1@Frederik.L: I was thinking that meta wasn't the right place for those types of questions - I thought that meta was for questions about Stack Overflow/Stack Exchange. – Qantas 94 Heavy May 22 '13 at 11:40
-
1@Qantas94Heavy my mistake, I meant superuser :P – Frederik.L May 22 '13 at 11:45
2 Answers
2
The page headers and footers are printed by the browser. They are not part of your HTML content, so you can't influence them directly in any way (css, jQuery, nothing).
You can show your users how to disable headers and footers in the "Page setup" printing form or you can generate the result as PDF and serve it, in this way you have full control on the result.

Irvin Dominin
- 30,819
- 9
- 77
- 111
-
first i tried to generate it as been pdf, bt i didnt get the exact output, then only i decided to print the page, now here it as been a another huge problem...? – raneena May 22 '13 at 11:38
0
If you are talking about the URLs that are displayed on the header and footer of the printout, then that's down to the print setting for each browser. You cannot remove it with code. The user has to select it each time according to the browser they're using.

Ted
- 3,985
- 1
- 20
- 33