Greasemonkey script (or Firefox extension) to stop sites from disabling copy-paste?

13

1

Is there a GreaseMonkey script to disable the JavaScript-disabling of copy-paste in Firefox (3.0)? Or should I just run NoScript or some other extension on any site that attempts this (other things might break...)?

[rant] Absolutely the worst "clever" use of JavaScript. Fortunately Safari is more usable and ignores the JavaScript hack that disables copy-paste. Who at Mozilla thought that was acceptable whatsoever? For shame. By the way, which browser added this "feature" first, IE? [/rant]

Jared Updike

Posted 2009-08-14T23:56:16.897

Reputation: 874

4you better not be copying and pasting any of this content, mister! – Jeff Atwood – 2009-08-14T23:58:06.567

2Sadly the people who do this probably don't have content anyone would want to steal any way. – Jared Updike – 2009-08-15T00:07:40.650

If it's pictures you're trying to copy, a nice print screen does the job. Sometimes, I'll copy a web page window to clipboard, crop the image I want in Photoshop, and then email it to the webmaster =D. For text, though, I guess you might need something else. – oscilatingcretin – 2011-08-18T18:55:00.640

Answers

4

The (dead link) Anti-Disabler script on diveintogreasemonkey.org works if you replace document. with document.wrappedJSObject.

Link appears to be dead now, here's a wayback link: http://web.archive.org/web/20110830050224/http://diveintogreasemonkey.org/download/antidisabler.user.js

and here's the script:

// Anti-Disabler
// version 0.5 BETA!
// 2005-06-28
// Copyright (c) 2005, Mark Pilgrim
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Anti-Disabler", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          Anti-Disabler
// @namespace     http://diveintomark.org/projects/greasemonkey/
// @description   restore context menus on sites that try to disable them
// @include       *
// @exclude       http://mail.google.com/*
// @exclude       https://mail.google.com/*
// ==/UserScript==

(function() {
    var e, i, all;

    document.onmouseup = null;
    document.onmousedown = null;
    document.oncontextmenu = null;

    all = document.getElementsByTagName("*");
    for (i = 0; i < all.length; i += 1) {
        e = all[i];
        e.onmouseup = null;
        e.onmousedown = null;
        e.oncontextmenu = null;
    }
})();

//
// ChangeLog
// 2005-06-28 - 0.5 - MAP - updated GMail URL
// 2005-04-21 - 0.4 - MAP - linted
// 2005-04-21 - 0.3 - MAP - exclude GMail
// 2005-04-18 - 0.2 - MAP - tidy code
// 2005-04-01 - 0.1 - MAP - initial release
//

Sam Hasler

Posted 2009-08-14T23:56:16.897

Reputation: 170

And that's why I hate link-only-answers... your link is dead! – Burkhard – 2015-03-11T11:18:14.640

@Burkhard Fixed – Sam Hasler – 2015-03-11T11:31:47.423

I understand this is an old answer. Just a note that it doesn't seem to *completely* work on http://postcalc.usps.com/. In the "Zip-Code" fields: Cut works from the context menu and the keyboard ("Ctrl-x" or "Shift-Del"). Copy works from the context menu and the keyboard ("Ctrl-c" or "Ctrl-Ins"). Paste works from the context menu and the keyboard ("Ctrl-v"), but NOT from keyboard ("Shift-Ins").

– Kevin Fegan – 2015-12-01T22:28:26.793

1

web official is dead, its source 2005?! ... look a source 2014 -> http://userscripts-mirror.org/scripts/review/30096

– KingRider – 2016-12-07T22:01:57.677

2

You may want to go to about:config and set dom.event.clipboardevents.enabled to false. This stopped the problems I was having with pages interfering with my clipboard.

user169501

Posted 2009-08-14T23:56:16.897

Reputation:

This is the only solution that worked for UPS's silly disabling service of those that I have tried (userscripts, disabling JS). – March Ho – 2017-06-26T11:01:57.597

1

I don't often toot my own horn. I actually was searching if anyone had a better method than my script:

http://userscripts.org/scripts/show/131063

Ultimately, I'd like there be an option within the browser that blocks javascript entries to onpaste events.

scuba_mike

Posted 2009-08-14T23:56:16.897

Reputation: 41

0

Jared Updike

Posted 2009-08-14T23:56:16.897

Reputation: 874

The Greasemonkey script on that page didn't work on the one site I tried it on. – Sam Hasler – 2009-08-15T13:38:05.123

To be specific, it won't defeat the script on this page: http://jsbin.com/icozi

– Sam Hasler – 2009-08-15T14:02:56.760

0

How about the good-old NoScript option with firefox?
I tried the site on the your answer and was allowed to right-click and save.
Then, I opened javascript block for the site and was blocked right-click!

nik

Posted 2009-08-14T23:56:16.897

Reputation: 50 788

0

Just disable the following option in Firefox's Javascript settings (it won't disable the warnings, as they are Javascript messages, but the context menu cannot be disabled by the web pages anymore):

enter image description here

TFM

Posted 2009-08-14T23:56:16.897

Reputation: 4 243

2Well, this is a very old answer (and question). I'm using Firefox v37.0.2. There is no "Advanced JavaScript Settings", and no option to stop scripts from "Disabling or replacing context menus". – Kevin Fegan – 2015-12-01T22:16:14.570

1There are some web-app sites where I want to have the their custom context menus. It's annoying to have to turn this on and off. A per-site way of blacklisting sites is needed. – Sam Hasler – 2009-08-15T13:40:22.203