Disabling window.print() on a specific website

Ask for help about NoScript, no registration needed to post
Guest

Disabling window.print() on a specific website

Post by Guest »

Hello,

How could I to disable the automatic initiation of the print dialogue (

Code: Select all

<script>window.print();</script>
) on a specific website?

Thank you,
John
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: Disabling window.print() on a specific website

Post by barbaz »

about:config
right-click > new > string
name:

Code: Select all

noscript.surrogate.noprint.replacement
value:

Code: Select all

Object.defineProperty(window, "print", {enumerable:true, get:function(){return function(){}}, set:function(){}});
right-click > new > string
name:

Code: Select all

noscript.surrogate.noprint.sources
value is an @ followed by a pattern matching that site (patterns described in ABE Rules .pdf) - say,

Code: Select all

@.example.com
Note that this completely zaps window.print...
*Always* check the changelogs BEFORE updating that important software!
-
Post Reply