当前位置:网站首页>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
边栏推荐
- 场景题:A系统如何使用B系统的页面
- EasyUI's combobox implements three-level query
- JS - accuracy issues
- JS changes the words separated by dashes into camel style
- IDEA查看历史记录【文件历史和项目历史】
- Configuration table and page information automatically generate curd operation page
- Visual programming - Experiment 2
- 2022 团体程序设计天梯赛 模拟赛 1-8 均是素数 (20 分)
- 可以接收多种数据类型参数——可变参数
- AWS from entry to actual combat: creating accounts
猜你喜欢
Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
深度学习笔记(二)——激活函数原理与实现
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
Huawei mobile ADB devices connection device is empty
Unity knowledge points (ugui 2)
Is it difficult to choose binary version control tools? After reading this article, you will find the answer
Fiddler use
Applet - WXS
Basic use of Charles
C interface
随机推荐
Explication détaillée des fonctions send () et recv () du programme Socket
Unity knowledge points (common core classes)
C interface
C set
QT uses drag and drop picture to control and mouse to move picture
Experiment 6 input / output stream
2022 group programming ladder simulation match 1-8 are prime numbers (20 points)
A comprehensive understanding of static code analysis
【VS Code】解决jupyter文件在vs code中显示异常的问题
全新的ORM框架——BeetlSQL介绍
Unity Basics
L3-011 直捣黄龙 (30 分)
JS changes the words separated by dashes into camel style
JS implementation of new
Unity games and related interview questions
Scenario Title: how does system a use the page of system B
可以接收多種數據類型參數——可變參數
Super easy to use asynchronous export function of Excel
File upload vulnerability summary and upload labs shooting range documentary
集合之List接口