WebmasterLingo
JustEdge Dedicated Servers

Go Back   WebmasterLingo > Programming Corner
User Name
Password

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old June 29th, 2004, 01:27 PM   #1
Fabolous05
Registered User
 
Join Date: Jun 2004
Location: Surrey, BC
Posts: 184
Fabolous05 is off the scale
Tutorial : Disable right click

Want to keep your content on your site only? Use one of the following right click blockers. Of course there are ways around it but many people will not know but it at least is a slight form of protection.

ALL CODE SHOULD BE PLACED IN <HEAD> </HEAD>

Script #1
Example:
http://members.shaw.ca/bavraj/norightclick/1.htm
This script will disable all right click of all kinds.
Code:
<!-- var message="No right click - Webmasterlingo.com"; 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>



Script #2
Example:
http://members.shaw.ca/bavraj/norightclick/2.htm
This one will disable right clicking but I think is more subtle because it doesn't pop anything up.
Code:
<script language=JavaScript> <!-- var message=""; function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document. onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontext menu=clickIE;} document.oncontextmenu=new Function("return false") // --> </script>



Script #3
Example:
http://members.shaw.ca/bavraj/norightclick/3.htm
This script will only disable right clicking on the images which is a nice feature
Code:
<script language="JavaScript1.2"> var clickmessage="Images are not to be copied" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images[i].onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() </script>
__________________
Fabo@VolantaStudios.com
Head Designer
Volantà Studios
Fabolous05 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 04:46 PM.

JustEdge Dedicated Servers