Pages

Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, 21 August 2015

How to Disable Right Click, Copy, and Paste for Web Page

Disable Right Click, Copy, and Paste for Web Page



Scenario: Prevent others from copying your web page contents, be it text or picture.

Solution:
1. Add this line into HTML BODY code:
ondragstart="return false" onselectstart="return false" oncontextmenu="return false"
2. Add this Java Script bellow HTML Header:
 <script type="text/JavaScript">
function killCopy(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=killCopy
document.onclick=reEnable
}
</script>
3. Now, nobody can right click, highlight, and copy any content out of your web page.

Note: Basic HTML editing skill is required for this task.