There are a wide range of ways of empowering right-click on a page, however the most well-known is to utilize JavaScript. In this blog entry, we’ll tell you the best way to do it utilizing void(document.oncontextmenu=null);. We’ll likewise tell you the best way to incapacitate right-click in the event that you want to. We should begin!
What Is Void Document Oncontextmenu=null?
Void(document.oncontextmenu=null); is a JavaScript code that empowers right-click on a website page. At the point when you add this code to your page, it will permit your guests to right-tap on any component on the page.
This is an incredible method for adding additional usefulness to your site or web application. For instance, you can utilize void(document.oncontextmenu=null); to empower right-click menu choices in a content manager. Or on the other hand, you can utilize it to add a right-click setting menu to a picture display.
Instructions to Enable Right Click
There are a couple of alternate ways of empowering right-click on a site page. One is to utilize the contextmenu occasion. This occasion is upheld by all significant programs, including Internet Explorer, Firefox, and Chrome.
One more method for empowering right-click is to utilize the onmousedown occasion. This occasion is upheld by all significant programs, aside from Internet Explorer.
At last, you can likewise utilize the oncontextmenu occasion. This occasion is upheld by all significant programs, including Internet Explorer, Firefox, and Chrome.
The most effective method to Disable Right Click
On the off chance that you really want to debilitate right-click on a website page, you can utilize void(document.oncontextmenu=null);. This code will keep your guests from right-tapping on any component on the page.
Assuming that you really want to debilitate right-click just on specific components, you can utilize the contextmenu occasion.
6 Other Ways to Enable Right Click on the Websites
Technique 1: Use the void(document.oncontextmenu=null); code
This is the most widely recognized method for empowering right-click on a page.
To utilize this technique, basically add void(document.oncontextmenu=null); to your website page.
You can add this code anyplace on the page, yet adding it close to the top is ideal.
This code will empower right-click on all components on the page.
Technique 2: Use the context menu occasion
The contextmenu occasion is upheld by all significant programs, including Internet Explorer, Firefox, and Chrome.
To utilize this strategy, just add oncontextmenu=”return valid;” to your desired component to empower right-click on.
For instance, to empower right-click on a picture, you would add the accompanying code:
<img src=”image.jpg” oncontextmenu=”return true;”>
Strategy 3: Use the onmousedown occasion
The unhoused occasion is upheld by all significant programs, with the exception of Internet Explorer.
To utilize this technique, basically add onmousedown=”return valid;” to your desired component to empower right-click on.
For instance, if you need to empower right-click on a picture, you would add the accompanying code:
<img src=”image.jpg” onmousedown=”return true;”>
Technique 4: Use a module or expansion
On the off chance that you’re utilizing a program that doesn’t uphold the contextmenu or onmousedown occasion, you can take a stab at utilizing a module or expansion.
For instance, the Firefox Right-Click Plugin empowers right-click on all components on a website page.
To utilize this strategy, just introduce the module and afterward empower it.
Technique 5: Use a user script
A user script is a little JavaScript record that runs in your program.
There are numerous user scripts that empower right-click on a website page.
To utilize this strategy, basically introduce a user script chief and afterward introduce a right-click empowering user script.
For instance, the Right Click Enabler user script empowers right-click on all components on a website page.
Technique 6: Use a bookmarklet
A bookmarklet is a little JavaScript record that you can bookmark and run in your program.
There are numerous bookmarklets that empower right-clicking on a site page.
To utilize this strategy, just make a bookmark and afterward add the JavaScript code to the bookmark.
For instance, the Enable Right Click Bookmarklet empowers right-click on all components on a site page.
void(document.oncontextmenu=null); is a code that you can use to empower right-click on a website page. This code will keep your guests from right-tapping on any component on the page.
You can add void(document.oncontextmenu=null); to your website page anyplace, yet adding it close to the top is ideal.
This code will empower right-click on all components on the page.
One more method for empowering right-click is to utilize the on mouse down occasion. This occasion is upheld by all significant programs, aside from Internet Explorer.
At long last, you can likewise utilize the context menu occasion. This occasion is upheld by all significant programs, including Internet Explorer, Firefox, and Chrome.
In this way, on the off chance that you really want to empower right-click on a website page, you can utilize void(document.oncontextmenu=null); or the contextmenu occasion.
End
In this blog entry, we’ve told you the best way to empower and cripple right-click on a website page. We’ve likewise told you the best way to utilize void(document.oncontextmenu=null); to empower right-click. Gratitude for perusing!