Saturday, September 24, 2011

How To Stopping Your User From Right -Clicking


Want to prevent your user from performing any of the other commands available by right-clicking on a Web page in Internet Explorer? It’s not foolproof, but this neat little HTML edit usually does the trick.
Just alter the opening <body> tag of your HTML to the following:


<body oncontextmenu="return false">

When the menu is requested, the oncontextmenu event runs, and we instantly cancel it using JavaScript. This is especially potent as a method for stopping the user from viewing your source, when used in conjunction with a menu-less browser window. Great stuff!

No comments :

Post a Comment