A Javascript script that disables right-click, select, drag, clear clipboard, and save a webpage as a prohibited object.
It is quite common. If you do not want to write it, copy it and use it directly without other settings.
- <Script language = "JavaScript">
- <! --
- ************* **************
- If (window. Event)
- Document. captureevents (event. mouseup );
- Function nocontextmenu ()
- {
- Event. cancelbubble = true
- Event. returnvalue = false;
- Return false;
- }
- Function norightclick (E)
- {
- If (window. Event)
- {
- If (E. Which = 2 | E. Which = 3)
- Return false;
- }
- Else
- If (event. Button = 2 | event. Button = 3)
- {
- Event. cancelbubble = true
- Event. returnvalue = false;
- Return false;
- }
- }
- ************ ***************
- Function noselect ()
- {
- Return false;
- }
- ************ ***************
- Function nodragstart ()
- {
- Return false;
- }
- // ************************* Clear the clipboard ************ *************
- Function keydown ()
- {
- VaR iekey = event. keycode;
- // Alert (iekey );
- If (iekey = 42)
- {
- // Window. clipboardData. setdata ('img ','')
- Window. clipboardData. cleardata ();
- }
- }
- // -->
- </SCRIPT>
- <! -- Disable saving a webpage as -->
- <NoScript> <IFRAME src = "*. htm"> </iframe> </NoScript>
- <! -- Disable saving a webpage as -->
- <NoScript> <IFRAME src = "*. htm"> </iframe> </NoScript> <script language = JavaScript>
- Document. oncontextmenu = nocontextmenu;
- Document. onmousedown = norightclick;
- Document. ondragstart = nodragstart;
- Document. onselectstart = noselect;
- Document. onselect = Document. selection. Empty ();
- Document. onkeydown = keydown;
- </SCRIPT>