当前位置:网站首页>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
边栏推荐
- socket编程 send()与 recv()函数详解
- Web Course Design - his system
- 2022 group programming ladder simulation match 1-8 are prime numbers (20 points)
- When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
- Experiment 5 components and event handling
- socket編程 send()與 recv()函數詳解
- 关于idea调试模式下启动特别慢的优化
- Problem a: face recognition
- 2021-08-31
- Generate QR code through zxing
猜你喜欢

Database SQL -- simulate inserting a large amount of data, importing / exporting database scripts, timestamp conversion and database basics

2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)

How to achieve centralized management, flexible and efficient CI / CD online seminar highlights sharing

Web Course Design - his system

2022 group programming ladder simulation match 1-8 are prime numbers (20 points)
![[mock data] fastmock dynamically returns the mock content according to the incoming parameters](/img/1e/c4aad49d16fb21a19865ba75128e43.png)
[mock data] fastmock dynamically returns the mock content according to the incoming parameters

【VS Code】解决jupyter文件在vs code中显示异常的问题

软件测试相关知识~

Unity knowledge points (ugui)

超好用的Excel异步导出功能
随机推荐
超好用的【通用Excel导入功能】
WinForm allows the form form to switch between the front and active states
第四次作业
Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]
JS implementation of new
Configure automatic implementation of curd projects
C-10 program error correction (recursive function): number to character
IDEA查看历史记录【文件历史和项目历史】
ThreadLocal test multithreaded variable instance
打卡:4.23 C语言篇 -(1)初识C语言 - (12)结构体
String input problem
Punch in: 4.23 C language chapter - (1) first knowledge of C language - (12) structure
深度学习笔记(二)——激活函数原理与实现
批量下載文件----壓縮後再下載
Supersocket is Use in net5 - startup
Chapter 8 of C language programming (fifth edition of Tan Haoqiang) is good at using pointer exercises to analyze and answer
JSON related
C-11 problem I: find balloon
JS, bind the event for a label with input, and then bind the stand-alone event in the parent element. The event is executed twice and solved
Use of ADB command [1]