Wednesday, 28 August 2013

Script to disable right click on a webpage

Leave a Comment
Script to disable right click on a webpage


This script is not a security for your data  on webpage, this script can be useful to some extent for users only. but this function just annoy's your user's.

Thers is only one way to stop users taking/copying  your content taken, you should not post it on the web.  :)

1)  <body  oncontextmenu="return false;">

 place   oncontextmenu="return false;" inside your opening body tag.


2) put this  head section of your webpage.

<script type="text/javascript"> function disableselect(e){ return false } function reEnable(){ return true } //for IE4+
document.onselectstart=new Function ("return false") documentdocument.oncontextmenu=new Function ("return false") //for NS6
if (window.sidebar){ documentdocument.onmousedown=disableselect documentdocument.onclick=reEnable
}</script>

0 comments:

Post a Comment