Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> Security >> No Right Click >> No Right Click


Code Snippet </> Info


Snippet Name: No Right Click

Description: You can disable (prevent) the right click of the mouse using this code snippet.


Compatible Browsers:
Chrome BrowserInternet Explorer BrowserOpera BrowserSafari Browser


Example: View Code Demo

Note: Simply adjust the
'var message="Function Disabled!";'
message with your own message.

Author: SnapBuilder <snippets@snapbuilder.com>

Last Modified: 2019-12-10 01:06:48

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying
Copied To Clipboard!

<html> <head> <title>Disable No Right Click Function Code Snippet</title> </head> <script> // Begin No Right Click Function from https://snapbuilder.com Free Public Codes Library var message="Function Disabled!"; /////////////////////////////////// function clickIE() {if (document.all) {alert(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {alert(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </script> <body> [ YOUR CONTENT GOES HERE ] </body> </html>


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library