Blocking automatic print dialogs

by Volker Weber

Most of the times, print versions of web pages are much better to read. No attention-grabbing ads, just clean text on a neutral background.

These pages often come with one downside. Web designers put some Javascript into the page to open the print dialog, which you then have to close if you want to read the page.

In Firefox it is pretty easy to block this behavior. Just create user.js in your profile directory and enter this:

// block print popups from Javascript
user_pref("capability.policy.default.Window.print", "noAccess");

No more print popups.

Comments

Great tip, but as a novice, how do I create the user:js in the profile directory? Thanks

skip brandon, 2006-10-30

Instructions

Volker Weber, 2006-10-30

For those who don't want to search the profile directory:


Type "about:config" as URL an hit return.
Right-click in the config page and select "New > String" from the context menu.
Fill in "capability.policy.default.Window.print" as the first value and "noAccess" as the second value.
Be aware that this new setting produces a JavaScript error "Error: uncaught exception: Permission denied to get property Window.print" whenever you open a page uses the described JavaScript. Every possible script call after "window.print();" will fail!

Christian Heindel, 2006-10-30

List of user.js scripts...

Erhardt Nel, 2006-10-30

Thanks, Erhardt.

I think we are better off making this setting more specific:

// block print popups from Javascript
user_pref("capability.policy.printsites.sites", "http://www.spiegel.de");
user_pref("capability.policy.printsites.Window.print", "noAccess");

For more than one site, just put more URLs into the string.

Volker Weber, 2006-10-30

Recent comments

Robert Schneider on Typ-2-Diabetes lässt sich wohl wieder zurückdrängen #dontbreakthechain at 18:28
Armin Grewe on Yancey Strickler :: The Internet is Becoming a Dark Forest at 17:44
Till Nachtmann on Yancey Strickler :: The Internet is Becoming a Dark Forest at 16:33
Volker Weber on Yancey Strickler :: The Internet is Becoming a Dark Forest at 15:22
Volker Weber on If you build barriers, people will build around you. If you are lucky. at 15:07
Armin Grewe on Yancey Strickler :: The Internet is Becoming a Dark Forest at 11:28
Theo Heselmans on If you build barriers, people will build around you. If you are lucky. at 11:13
Tim Oliver Spielmann on Ladeprobleme mit dem Apple Smart Battery Case at 09:00
Maikel Maes on Externe SSD mit USB-C für aktuell 88 Euro at 00:38
Volker Weber on Yet another butterfly for Apple at 20:58
Bernd Hofmann on Yet another butterfly for Apple at 19:24
Volker Weber on If you build barriers, people will build around you. If you are lucky. at 18:40
Jochen Kattoll on How to find text on a page in iOS Safari at 17:53
Christian Ott on Dark mode? Light mode. at 15:49
Ingo Seifert on How to find text on a page in iOS Safari at 14:35
Ben Langhinrichs on If you build barriers, people will build around you. If you are lucky. at 14:33
Volker Weber on Externe SSD mit USB-C für aktuell 88 Euro at 13:43
Martin Kautz on Externe SSD mit USB-C für aktuell 88 Euro at 11:49
Volker Weber on Externe SSD mit USB-C für aktuell 88 Euro at 11:35
Marc Beckersjuergen on Externe SSD mit USB-C für aktuell 88 Euro at 11:34
Martin Kautz on How to find text on a page in iOS Safari at 10:56
Horia Stanescu on How to find text on a page in iOS Safari at 10:38
Thomas Cloer on Dark mode? Light mode. at 10:35
Markus Mews on How to find text on a page in iOS Safari at 08:55
Oliver Regelmann on How to find text on a page in iOS Safari at 08:23

Ceci n'est pas un blog

I explain difficult concepts in simple ways. For free, and for money. Clue procurement and bullshit detection.

vowe

Contact
Publications
Stuff that works
Amazon Wish List
Frequently Asked Questions

rss feed  twitter  amazon

Local time is 01:32

visitors.gif

buy me coffee

Paypal vowe