- Joined
- Jun 14, 2004
- Posts
- 11,076
- Reaction score
- 962
Disable Right Mouse Click if you want to stop someone easily stealing your website's valuable content:
No right click code:
Change the line:
to whatever message you want to display. "test it here" is where your site content would appear.
This can be easily bypassed by those in the know and Windows XP SP2 makes things more difficult as it gives the visitor the option to view the page without running this code but it is still better than nothing.
No right click code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Your Title Here</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
function noRightClick(buttonClicked) {
if (navigator.appName == 'Netscape' &&
(buttonClicked.which == 2 || buttonClicked.which == 3))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 3 || event.button == 2)) {
alert("Sorry! This site is Copyright right click has been disabled");
return false;
}
return true;
}
document.onmousedown=noRightClick;
document.onmouseup=noRightClick;
if (document.layers)
window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=noRightClick;
window.onmouseup=noRightClick;
</script>test it here
</body>
</html>
Change the line:
Code:
alert("Sorry! This site is Copyright right click has been disabled");
This can be easily bypassed by those in the know and Windows XP SP2 makes things more difficult as it gives the visitor the option to view the page without running this code but it is still better than nothing.