CeylonLanka.info

Sri Lanka's Largest information network. Sri Lanka, Ceylon Lanka, All about Sri Lanka, Provinces, Districts, Government Offices, Private sector, Hospitals, Roads with general travel information and places to travel.

Disable Right Click to Save and Drag and Drop on Images

The first thing you want to do is to enter a code injection throughout your whole site.  From the Home menu of your Squarespace editing dashboard, click Settings → Advanced → Code Injection.  If you need more help getting to this screen, check out our Code Injection tutorial.  In the text box entitled Header, paste the following code



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


Once you've pasted the code, click Save and return to the home menu.  From there, we need to enter some custom CSS.  To enter the CSS, click Design → Custom CSS.  For more help on entering custom CSS, check out our CSS tutorial.  In the text box, paste the following code


  img {
      -moz-user-select: none;
      -webkit-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-user-drag: none;
      user-drag: none;
      -webkit-touch-callout: none;
    }



That's all....
logoblog

Thanks for reading Disable Right Click to Save and Drag and Drop on Images

Previous
« Prev Post