Friday, April 13, 2018

Disable Right-Click menu in JavaScript

Here is a simple script written in JavaScript that will disable right click to prevent user to view the code of your web page.

I am currently accepting programming work, it project, school programming projects , thesis and capstone projects, IT consulting work and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.




Sample Program Output


Program Listing

rightclick.htm

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Disable righ-click menu</title>
<script language="javascript">
 function click() 
 {
    if (event.button==2)     
    {
    alert('Stop using right-click menu!');
    }
 }
 document.onmousedown=click; 
</script>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<body oncontextmenu="return false;" >
<div>
  <div align="center">
    <p>&nbsp;</p>
    <p>Stop using right-click menu! </p>
 </div>
</div>
</body>
</html>





No comments:

Post a Comment