Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 3

How can I override the browser's right-click settings?


Guest

Question

I was wondering if you could please help me as I would greatly appreciate it. I am really in a jam...

Could you please tell me the code able to BLOCK RIGHT CLICK so people can not see/view resources....

I can't thank you enough in advance...

Best to you,

Gianluca

Link to comment
  • Answers 32
  • Created
  • Last Reply

Recommended Posts

Inject this header code. This worked better for me:


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


Link to comment

This worked better for me:


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

Link to comment

I use this code to disable the Save option on iOS (iPhone and iPad):


body {
   -webkit-user-select:none !important;  
   -webkit-touch-callout:none !important;
 -moz-user-select:none !important; 
 -ms-user-select: none !important; 
 user-select: none !important;
 touch-callout: none !important;
}

It can be added to the Design -> Custom CSS panel of your site. It doesn't work on Chrome, but it's a start.

Link to comment

I'd like to be able to provide a good viewing experience to site visitors, with large images, but I don't want to make it *too" easy for them to download. A 1500 pixel wide image is marginally printable, and it can certainly be used for unauthorized web display, even if it's cropped or resized.

I was hoping that I could avoid dropping the size down to something that wouldn't be of much use to unauthorized "borrowers".

If dragging an image from a page would always result in a file that was the smallest of Squarespace's six sizes, then I'd probably be OK with uploading 1000-1200 pixel originals.

I suggested this in a Customer Care ticket, and I'm waiting for a response....

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 worked on Chrome for me today. Thank you all so much !!!!!

Link to comment

Can't promise this is going to work but in your code injection add


<SCRIPT language=JavaScript>
   var message = "function disabled"; 
   function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){   alert(message); return false; } 
   if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {  alert(message);     return false; } } 
   document.onmousedown = rtclickcheck;
</SCRIPT>

Note: This will just stop them right clicking. If they want to there are other ways for people to view source code.

I'm also unsure if SS6 has Java or Jquery installed.

Link to comment

I figured out how to get rid of the annoying Alert message. Just inject this header code:


<script language=JavaScript> var message=""; 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("return false") </script>

You are very welcome ;)

Link to comment

Archived

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

Guest
This topic is now closed to further replies.

×
×
  • Create New...