How to Disable Right Click on Your Everweb Website

0
2144
paste right click code in head field everweb

You may want to remove the right click feature so that your website visitors cannot download your image files easily.

In most desktop web browser, you can right click on an image and save it to your computer. Some artists or photographers may want to protect other people from downloading or stealing their images from their web site.

Although this method does not really protect your images because you can still easily download images from any web browser, it may make the process a little more difficult for visitors to save your images to their computer.

To disable the right click menu in your EverWeb web site you can use the code snippet below and follow these steps;

  1. Open your website in EverWeb
  2. Go to the File menu and select ‘Edit Publishing Settings’
  3. Paste the code below in the Head Code Section

<script>
window.addEventListener(“contextmenu”, e => e.preventDefault());
</script>

Here is the code to disable the right click menu pasted into the Head Code section of the Publishing Settings Screen in EverWeb.

Disable right click menu EverWeb

The above code will disable right click on your entire page. However, if you would like to disable right click only when your visitor tries to right click on an image, you can use the following code. This method is better because often times your visitor may want to right click a link to open it in a new window, or right click selected text to copy it.

<script>
//<![CDATA[
function nocontext(e) {
var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
if (clickedTag == “IMG”) {

//alert(“Right click is disabled”)
return false;
}
}
document.oncontextmenu = nocontext;
//]]>
</script>

What Does this code do?

The above code will check to see what type of element your visitor has clicked on. If it is an image element, the right click function will not be passed to the web browser and so the visitor won’t be able to save the image easily to their desktop.

Notice the following line that starts with the two // here;

//alert(“Right click is disabled”)

This is a line of code that has been turned into a comment by including the // in front of it. If you remove the two // then when your visitor tries to right click on an image, they will see a dialog popup telling them that they cannot right click since it has been disabled. Fel free to use this dialog box and to customize the message your visitor will see when they try to right click on an image,

Limitations of Disabling Right Click on your Website

Generally it is not advisable to disable the right click menu like this. The reasons are because it is still very easy to download image files from any website. Once your image is shown in a web browser it can still be downloaded by inspecting the source code, which cannot be disabled.

Your visitor can also simply take a screenshot of the image in their web browser and save it to their computer.

How to Properly Protect Images Online

The only real way to protect images online is to use a watermark. That means placing a small image or text in a corner of your image, or add subtle markings throughout the image.

Otherwise, once you upload an image online, it is possible for anyone to easily download it, even if you disable the right click menu.

Alternatively you can use a lower quality version of the image on your website. Images on web sites do not have to be the same high quality you would use for printing an image.

 

Leave a reply

Facebook
Twitter
YouTube