Sometimes it is required to prevent images on web pages being copied by another one. You can prevent the images by disabling the right click on your web page or by disabling image context menu on images only. Here I am going to share that how can you achieve this?
Disable right click on images
For disabling the image context menu on right click on images, just add the below event handler to the img or image tag as shown below
Disable right click on web page
Similarly we can disable the right click on web page by adding the oncontextmenu handler in body tag of the page. This will disable right click on each and every control of a webpage.
Show alert message on right click