Knowledgebase: Site Design

How do I disable right-click on my site?

 

A common way to prevent your site images from being used without your permission is to limit the ability of someone saving the image to their desktop. A popular way of doing this is to restrict "right-click" on your pages. This prevents site visitors from right-clicking on your pages and selecting "Save As" on images. This can be done through the use of a simple javascript code.

To disable the right-click on your site you can paste the following code into your global header or global footer.

From your Online Store Manager, go to Content >Header & Footer and add the following code to either global section
(Be sure to enable the heaber/banner that you paste this into):

<script language=JavaScript>
<!--
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// ->
</script>

When applied, visitors to your site will not be able to use their browser's right-click menu in order to save your site content.

Note:
While this will prevent right-clicking on your site in order to protect your site images, it is merely intended as a deterent. Be aware that there are ways to bypass this by knowledgeable users. Therefore, you should consider combining the disable right-click code with other protective measures on your images such as watermarking them.


Help Desk Software by Kayako fusion