TechJunkie is a BOX20 Media Company

Home Web What is ‘void document oncontextmenu null’ ? How To Re-Enable the Right Click

What is ‘void document oncontextmenu null’ ? How To Re-Enable the Right Click

What is ‘void document oncontextmenu null’ ? How To Re-Enable the Right Click

If you land on a website and find a cool quote or piece of code you want to copy and nothing happens when you right click, this tutorial is for you. A number of notable websites disable right clicking on their pages to stop theft or copying. There is a method behind this madness but it doesn’t work for users. Void document oncontextmenu null is a piece of JavaScript you can use to work around it.

There are a few ways to circumvent the inability to right click on web pages. While I do not condone copyright theft or copying of entire pages, I do support the ability to take quotes, useful pieces of code or other snippets from pages for your own use. As a tutorial writer, I appreciate that saving a series of troubleshooting steps elsewhere makes fixing your problems easier. Not everyone is as enlightened as I am though.

How to enable right click on websites that block it

Depending on the website in question, the administrator will use JavaScript or HTML code to block the right click context menu. There are a bunch of ways you can work around this limitation and using ‘void document oncontextmenu null’ is just one of them. I’ll describe a few of the ways here.

If you land on a webpage and want to copy something from it, try pasting ‘void document oncontextmenu null’ into the URL bar of the page. You should now be able to right click as normal and do what you need to do. You will need to do this every time you want to copy something but it works like a charm on many pages.

It isn’t universal though as there are a range of ways website owners use to block right click. If that doesn’t work, try one of these methods.

Save the page

The easiest way I have found around the right click block is to save the entire page as HTML. I then open it in the browser again and am able to right click, copy, paste and do whatever I like. This is useful if there are multiple quotes or pieces of code I want to use. This works with most browsers although if you use Edge, you may have to save the page as HTML and then open it in Firefox or Chrome to get it working properly. I had trouble getting it to work and you may do too.

Disable JavaScript altogether

This is something if a nuclear option as it can completely break web pages. If the website uses JavaScript to block the right click dialog, disabling it will stop it interfering in what you’re doing. How you do that depends on the browser you’re using.

In Firefox:

  1. Open a new tab and type ‘about:config’.
  2. Search for JavaScript.
  3. Double click ‘javascript.enabled to make it false instead of true.

In Chrome:

  1. Select the three dot menu icon in the top right and select Settings.
  2. Select Advanced and Content Settings within Privacy and Security.
  3. Select JavaScript and toggle it to off.

Disabling JavaScript can stop some sites from working properly and some from working at all. Use this setting carefully and only if you have to.

Use a browser plugin

More effective than disabling JavaScript altogether is the use of plugins to re-enable the right click dialog. Firefox and Chrome have a bunch of them and some of them work perfectly. Search your default browser plugin section for ‘right click’ or words to that effect and see what comes up.

I use Firefox Quantum and over a thousand results came up for ‘right click’. Some of them are irrelevant but the top few plugins where exactly what I was looking for. You should find the same whatever browser you use.

Going to the source

If you only occasionally need to copy something from web pages, you may just find it easier to view the source code. While adding ‘void document oncontextmenu null’ to the URL bar takes less time, having the code around isn’t always going to  be convenient. Remembering Ctrl + U will be.

Open the page you want to right click on and hit Ctrl + U. It will bring up a new tab showing the source code of the page. You can scour the code for the text you need to Ctrl + F to find it. You should then be able to copy the text as required without any problems. Both Ctrl + U and Ctrl + F will work on all recent browsers.

The ability to right click and copy text from web pages should be used sparingly and only when necessary. A lot of time and effort goes into creating content for you to enjoy so please copy responsibly!

Does Tinder Passport Work?

Read Next 

Leave a Reply

Your email address will not be published. Required fields are marked *


Random

Jan 7, 2019

944 Articles Published

More