当前位置:网站首页>The content of the website is prohibited from copying, pasting and saving as JS code
The content of the website is prohibited from copying, pasting and saving as JS code
2022-04-23 03:27:00 【Python code doctor】
1、 Disable right click and copy
Method 1:
Add the following code to the page :
Copy the code as follows :
<script language="Javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
</script>
Method 2:
Add the following code to :
<body oncontextmenu="return false" onselectstart="return false">
or
<body oncontextmenu="event.returnValue=false" onselectstart="event.returnValue=false">
In essence , Method 2 With the method 1 It's the same .
Method 3:
If you only restrict replication , You can add the following code :
2、 Make menu " file "-" Save as " invalid
If you just disable right clicking and selecting copy , Others can also use... In the browser menu " file "-" Save as " Copy files . In order to torture Shell failure , You can add the following code between and :
Copy the code as follows :
<noscript>
<iframe src="*.htm"></iframe>
</noscript>
such , When a user saves a web page , Will appear " Can't save Web page " Error of .
in addition , You can also use event.preventDefault() To stop oncontextmenu() also onselectstart()
Copy the code as follows :
document.oncontextmenu=function(evt){
evt.preventDefault();
}
document.onselectstart=function(evt){
evt.preventDefault();
};
Since you can prohibit , Then, of course, you can also enable it , Just reassign the event , It can be assigned to null, Or a string 、 Boolean values will do . Such as :
Copy the code as follows :
document.oncontextmenu="";
document.onselectstart=true;
perhaps Ban js: Open Google browser , choice “ Set up ” – choice “ Privacy settings ” – Options “ The content Settings ” – choice “JavaScript” – choice “ No website is allowed to run JavaScript”, Refresh after setting .
版权声明
本文为[Python code doctor]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220619243735.html
边栏推荐
- L3-011 直捣黄龙 (30 分)
- List interface of collection
- C-11 problem h: treasure chest 2
- Do you really understand hashcode and equals???
- Visual programming - drawing assignment
- Generate QR code through zxing
- js 中,为一个里面带有input 的label 绑定事件后在父元素绑定单机事件,事件执行两次,求解
- Huawei mobile ADB devices connection device is empty
- Peut recevoir plusieurs paramètres de type de données - paramètres variables
- Unity games and related interview questions
猜你喜欢

Unity knowledge points (common core classes)

MySQL之explain关键字详解

Charles uses three ways to modify requests and responses

Codeforces Round #784 (Div. 4)题解 (第一次AK cf (XD

JS inheritance

2022 group programming ladder simulation l2-1 blind box packaging line (25 points)

JS - accuracy issues

Is it difficult to choose binary version control tools? After reading this article, you will find the answer

Course design of Database Principle -- material distribution management system

淺學一下I/O流和File類文件操作
随机推荐
The fourth operation
Visual programming -- how to customize the mouse cursor
Visual programming - Experiment 2
File upload vulnerability summary and upload labs shooting range documentary
2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
Cefsharp stores cookies and reads cookies
Visual programming - drawing assignment
PWA I'm here
The website JS in. Net core cefsharp chromium WebBrowser calls the C method in winfrom program
List interface of collection
MySQL grouping query rules
超好用的【通用Excel导入功能】
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
打卡:4.23 C语言篇 -(1)初识C语言 - (12)结构体
C set
Flink real-time data warehouse project - Design and implementation of DWS layer
Iotos IOT middle platform is connected to the access control system of isecure center
Problem a: face recognition
Problem C: realize Joseph Ring with linked list
深度学习笔记(二)——激活函数原理与实现