Skip to content

Instantly share code, notes, and snippets.

@hidao80
Last active September 5, 2023 09:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hidao80/2baeb927a8e746ac0ba7a8578f798f12 to your computer and use it in GitHub Desktop.
Save hidao80/2baeb927a8e746ac0ba7a8578f798f12 to your computer and use it in GitHub Desktop.
Bookmarklet to enable context menus on web pages that do not allow right-clicking.
javascript:(()%3D%3E%7B!function()%7Bfor(const%20o%20of%5Bdocument%2Cdocument.body%5D)o.addEventListener(%22contextmenu%22%2C(o%3D%3E%7Bo.stopImmediatePropagation()%7D)%2C!0)%7D()%3B%7D)()
(function() {
for (const elem of [document, document.body]) {
elem.addEventListener('contextmenu', e => {
e.stopImmediatePropagation();
}, true);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment