Jump to content

Right Click option being disabled

Recommended Posts

Site URL: http://www.garyatkinsphotography.co.uk

Hi There,


I am after the latest code injection to stop people right clicking on my images, I did come across some on the forum but had this script message on my gallery page - script type="text/javascript"> $(document).ready(function () { //Disable full page $("body").on("contextmenu",function(e){ return false; }); //Disable part of page $("#id").on("contextmenu",function(e){ return false; }); });



Link to comment
  • Replies 8
  • Views 1.7k
  • Created
  • Last Reply
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
 $(function () {
   $(this).bind("contextmenu", function (e) 

You can use the code above in advanced header. 

That being said: Think about it before you do it. 

Many browsers have a security option to disallow disabling of the right click (context) menu anyway.

I used control+c to copy the above code, right click was disabled on the Squarespace site where I found it . I could easily use a print screen app to capture any image. I only say this to present the full picture. 


Link to comment

Thanks, even though i add this in to the header i get this at the top of my portfolio page.


script type="text/javascript"> $(document).ready(function () { //Disable full page $("body").on("contextmenu",function(e){ return false; }); //Disable part of page $("#id").on("contextmenu",function(e){ return false; }); });

Link to comment

<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>


This is what i copied in to my header, I have now removed this.

Link to comment
On 12/7/2020 at 6:04 AM, derricksrandomviews said:

That being said: Think about it before you do it. 

I agree with Derrick. You can disable the right click and someone will just view the source code if they really want something from your site. The command is right there on most browsers.

Now if you're trying to protect images you could consider watermarking software. But again. You'd have to find the violator and then go after them legally and prove theft of images.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.