[HACK] Disable Copy

For Articles relating to more than one ISC version
Post Reply
SamX
Posts: 14
Joined: Thu Jul 09, 2009 11:26 pm

[HACK] Disable Copy

Post by SamX »

Some users wants to protect your images or description on your store

To Disable Right Click with Text (It works on Firefox too)

Open templates/YourTemplate/Panels/HTMLHead.html

Before </head> add:

Code: Select all

<script language=JavaScript>
<!--
var message="Your Site - www.yoursite.com";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
1
}
}
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>
To disable Text Selection:

Before </head> add:

Code: Select all

<script language="JavaScript1.2">

// IE
document.onselectstart=function(){
if(event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")
return false
else return true;
};
// FIREFOX
if (window.sidebar){
document.onmousedown=function(e){
var obj=e.target;
if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD")
return true;
/*else if (obj.tagName=="BUTTON"){
return true;
}*/
else
return false;
}
}
</script>
With this script the users can´t select text but can use search and login boxes.

Enjoy
ISC 6.1.1 Multi-Vendor Edition
Post Reply