the codery

Safari : how to print a header with the page address (URL)

Default printing in Safari does not add a header with the page address (URL), as do other browsers.

This is OK for me, most of the time, sometimes not.

Here is a tip to fill the gap.

Installation, short version:

Installation in details:

javascript: 
	if (document.body.firstChild.id == 'print_URL_header') {
		document.body.removeChild(document.body.firstChild);
	} else {
		entete = document.createElement('pre');
		entete.setAttribute('id','print_URL_header');
		entete.appendChild(document.createTextNode(document.URL));
		document.body.insertBefore(entete, document.body.firstChild, null);
		window.print();
	}

Usage

You got a new "button" for this specific function.

You can move this bookmark as you like, as with any bookmark.

Remarks

	entete.appendChild(document.createTextNode(document.URL));
	entete.appendChild(document.createTextNode(Date()+' - '+document.URL));

web 2 development

a/X

The author of this page is a freelance web developer.

For more information, see the site.