JavaScript Disable default print header and footer across all browsers jQuery or css [duplicate] disable default print

I have written some stylesheets - including a print.css - and it's working fine.

I'd like to remove the URL from printing out on each of the pages. I am beginning to wonder if it is impossible. Is there an element/option that I can set to display:none to do this?

The reason is that the specific pages that have a 'normal' and 'print' stylesheet have been specially formatted so when printed, it forms a meaningful booklet. Therefore the URL is irrelevant.

Answer:1

If I understand you correctly, you talk about the page headers and footers. They are printed by the browser. They are not part of your HTML content, so you can't influence them directly.

Show your users how to disable headers and footers in the «Page setup...» dialog.

Answer:2

It depends on your web browser. If you're using Firefox you can adjust or turn off those header and footer lines (URL, page number, etc) by going into File > Page Setup then clicking the Margins & Header/Footer tab.

Answer:3

The headers and footers for printing from browsers is, sadly, a browser preference, not a document-level element that you can style. Refer to my very similar question for further workarounds and disappointment.

Answer:4

I've also tried everything but finally I'm writing below code to make URL shorter:

var curURL = window.location.href;
history.replaceState(history.state, '', '/');
window.print();
history.replaceState(history.state, '', curURL);

But you need to make a custom PRINT button for user to click.

Answer:5

I assume that you are talking about the URL that shows in the footer of the page.

If so, this is set by the browser and it is not something that you can do from your code.

Answer:6

I am not sure but the URL is added by a browser when you want to print. It is not part of the page so can not be affected by CSS. Maybe there is a way but it will be browser dependent.

Answer:7

i found something in the browser side itself.

Try this steps. here i have been mentioned the Steps to disable the Header and footer in all the three major browsers.

Chrome Click the Menu icon in the top right corner of the browser. Click Print. Uncheck Headers and Footers under the Options section.

Firefox Click Firefox in the top left corner of the browser. Place your mouse over Print, the click Page Setup. Click the Margins & Header/Footer tab. Change each value under Headers & Footers to --blank--.

Internet Explorer Click the Gear icon in the top right corner of the browser. Place your mouse over Print, then click Page Setup. Change each value under Headers and Footers to -Empty-.

Answer:8

I know I can create a self-invoking, nested function like this (function ns(){ (function Class(){ alert('ns.Class fired'); })(); })();​ But it's ugly, and doesn't look quite ...

I know I can create a self-invoking, nested function like this (function ns(){ (function Class(){ alert('ns.Class fired'); })(); })();​ But it's ugly, and doesn't look quite ...

I'm trying to create a namespace for my backbone app so I can make calls globally. Normally, I'd just do it like this: var myNamespace = window.myNamespace || {}; myNamespace.SomeView = Backbone....

I'm trying to create a namespace for my backbone app so I can make calls globally. Normally, I'd just do it like this: var myNamespace = window.myNamespace || {}; myNamespace.SomeView = Backbone....

I am using this script to have a popup box with some setting in my site: http://codeissue.com/articles/a04daf3210c8b0a/cross-browser-modal-popup-using-javascript-jquery The popup opens when click a ...

I am using this script to have a popup box with some setting in my site: http://codeissue.com/articles/a04daf3210c8b0a/cross-browser-modal-popup-using-javascript-jquery The popup opens when click a ...

I have a very simple use case. I have an xhr object of ids of facebook users. Now I just want to display the images of the users in the following way. xhr.objects.forEach(function (user) { $('#...

I have a very simple use case. I have an xhr object of ids of facebook users. Now I just want to display the images of the users in the following way. xhr.objects.forEach(function (user) { $('#...