Home » Questions » Computers [ Ask a new question ]

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

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

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...)?

Asked by: Guest | Views: 226
Total answers/comments: 3
Guest [Entry]

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

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

and here's the script:

// Anti-Disabler
// version 0.5 BETA!
// 2005-06-28
// Copyright © 2005, Mark Pilgrim
// Released under the GPL license
// http://www.gnudotorg/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdevdotorg/
// 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://diveintomarkdotorg/projects/greasemonkey/
// @description restore context menus on sites that try to disable them
// @include *
// @exclude http://mail.google.com/*
// @exclude 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
//"
Guest [Entry]

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

http://userscriptsdotorg/scripts/show/131063

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

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):