当前位置:网站首页>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
边栏推荐
- poi根据数据创建导出excel
- JS recursive tree structure calculates the number of leaf nodes of each node and outputs it
- WinForm allows the form form to switch between the front and active states
- Unity knowledge points (common core classes)
- JS changes the words separated by dashes into camel style
- Idempotency practice operation, explaining idempotency based on business
- POI create and export Excel based on data
- 12. < tag linked list and common test site synthesis > - lt.234 palindrome linked list
- Using swagger in. Net5
- 通过 zxing 生成二维码
猜你喜欢

. net webapi access authorization mechanism and process design (header token + redis)

"Visual programming" test paper

MySQL之explain关键字详解

Development record of primary sensitive word detection

MySQL索引详解【B+Tree索引、哈希索引、全文索引、覆盖索引】

Basic use of Charles

Unity games and related interview questions

可以接收多種數據類型參數——可變參數

Unity knowledge points (ugui)

New ORM framework -- Introduction to beetlsql
随机推荐
Supersocket is Use in net5 - concept
Scenario Title: how does system a use the page of system B
【微服务】(十)—— 统一网关Gateway
批量下载文件----压缩后再下载
New ORM framework -- Introduction to beetlsql
通过 zxing 生成二维码
Visual programming -- how to customize the mouse cursor
Use of ADB command [1]
Using jsonserialize to realize data type conversion gracefully
C-11 problem h: treasure chest 2
MySQL grouping query rules
Docker拉取mysql并连接
Can you answer the questions that cannot be answered with a monthly salary of 10k-20k?
The query type of MySQL is very inefficient.
可以接收多種數據類型參數——可變參數
JS calculates the display date according to the time
Learn about I / O flow and file operations
Do you really understand hashcode and equals???
移植tslib时ts_setup: No such file or directory、ts_open: No such file or director
Unity knowledge points (common core classes)