HTML DOM addEventListener() Method
The addEventListener() Method attaches an event handler to the specified element.
Syntax:
document.addEventListener(event, function, useCapture)
How to disable right click on web page using JavaScript ?
Disabling right-click on a web page can be done using the DOM Events. It is a client-side action, and it can be achieved using JavaScript.
However, it’s important to note that attempting to prevent right-clicking is not a foolproof method for protecting your content, as users can easily bypass it by disabling JavaScript or using browser features.
To disable right click on web page in JavaScript we can use the methods given below:
Table of Content
- HTML DOM addEventListener() Method
- JavaScript preventDefault() Event Method