Jump to content

Can I disable viewers 'dragging and dropping' my jpeg images onto their desktop?

Recommended Posts

  • 2 weeks later...
  • 2 months later...
  • 9 months later...

Hello! ^.^I have been trying to edit my HTML code on my blog and place the codes under the HEADER or my SIDEBAR on my blog, but it all seems to fail... what am I doing wrong? Why it isn't working? ANy suggestions?

Link to comment
  • 6 months later...

adding this bit to prevent right-click


<script type="text/javascript">
     function nocontext(e) {
       var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
       if (clickedTag == "IMG")
         return false; 
     }
     document.oncontextmenu = nocontext;
   </script>
<style>img {
 -webkit-user-drag: none;
 -khtml-user-drag: none;
 -moz-user-drag: none;
 -o-user-drag: none;
 user-drag: none;
} </style>




Edited by ryguild
Link to comment
  • 1 year later...
  • 4 months later...
  • 6 months later...

No Its Not Figured Out Yet But Team Is Working On It And I Am Sure It Will Solved Very Soon; This Is One The Most Common Problem Faced By The SquareSpace Users.

Link to comment
  • 7 months later...
  • 1 year later...
On 9/3/2015 at 6:00 AM, Megalomaniac said:

Hello world. I found this out there. I believe its from two sources, I do not recall where exactly, but i love it! Special Thanks to those coding geniuses out there!

This cleanly disables drag and drop of images and disables the right click over all images.

Simply place this in your main CODE INJECTION under HEADER. Save it and your done!

 
<HTML>
 <HEAD></HEAD>
 <BODY on contextmenu="return false;" onselectstart="return false;" ondragstart="return false;">
 </BODY>
</HTML>

<script>
document.oncontextmenu = function(e){
   var target = (typeof e !="undefined")? e.target: event.srcElement
   if (target.tagName == "IMG" || (target.tagName == 'A' && target.firstChild.tagName == 'IMG'))
       return false
}
</script>

 

 

Best to you all out there, Megalo

Thank you, thank you, thank you! This one serves the purpose. Truly appreciate you for sharing it!

Link to comment
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.