It is possible to prevent your visitors to make a right click on your webpage. This permits a protection of the source code of your website and your photos.
Put this script between <HEAD> and </HEAD> tags of your HTML code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Disable
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>
Another option is to disable right click in each body tag:
<body onselectstart="return false" oncontextmenu="return false" ondragstart="return false" onMouseOver="window.status='..message perso .. '; return true;" >
This protection is relative, it really does not preserve your webpages, since there are several ways (all data and extremely easy as pressing both mouse buttons simultaneously or bombard with mouse right clicks… at the limit, take a picture of the screen) to counter for protection.
For example, in Firefox, to work around this “protection”:
Go to Tools > Options > Web Features > Advanced and uncheck “Disable or replace context menu”.
It is also possible to simply disable JavaScript or use a browser that does not support it.
Tags: How to, JavaScript, Tips and Tricks, Web, Webmastering



