Atkinsg88 Posted December 4, 2020 Posted December 4, 2020 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; }); });
derricksrandomviews Posted December 7, 2020 Posted December 7, 2020 <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) ); }); </script> 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. https://www.theoryhousecreative.com/blog/disable-right-click-in-squarespace
Atkinsg88 Posted December 7, 2020 Author Posted December 7, 2020 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; }); });
Atkinsg88 Posted December 7, 2020 Author Posted December 7, 2020 How do i remove the above issue from my page?
tuanphan Posted December 8, 2020 Posted December 8, 2020 I guess you copied it from some one & add to Header. Try checking all code in Page Header, Code Injection & remove it. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
derricksrandomviews Posted December 9, 2020 Posted December 9, 2020 The site link I posted has another block of code, depending on the template you are using that second code may be needed.
Atkinsg88 Posted December 9, 2020 Author Posted December 9, 2020 <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.
creedon Posted December 10, 2020 Posted December 10, 2020 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.