Sometimes, we don't want the content presented in our web page to be stolen by someone with ulterior motives, so we need to add a function to prohibit copying on the web page. However, general browsers can still use copy as plain text after prohibiting copying, which cannot completely eliminate this problem. At this time, we need to completely prohibit right-clicking and copying on the page. It is actually very simple to implement. You only need to add the following tags to the web page (note that it is immediately after the body): <body topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"> This is just a preliminary method and can be easily cracked. If you are afraid that the webpage will be saved as a local file by others, you can add the following code to prevent others from saving it: <noscript> <iframe src="*.htm"></iframe> </noscript> Finally, some webmasters may only need a function to prohibit copying, and do not need to prohibit right-clicking. In this case, add the following code in <body>: <body onmousemove=/HideMenu()/ oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Use of MySQL stress testing tool Mysqlslap
>>: Docker configuration Alibaba Cloud image acceleration pull implementation
Table of contents 1. Decoupled assignment of arra...
Table of contents 1. What is a window function? 1...
Adding/removing classes to elements is a very com...
What is JConsole JConsole was introduced in Java ...
NC's full name is Netcat (Network Knife), and...
First, let's look at an example of memory rel...
Table of contents 1. What is currying 2. Uses of ...
The first step is to prepare an icon making softwa...
1. Introduction to Logrotate tool Logrotate is a ...
1. What are the formats of lines? You can see you...
We can use the scp command of Linux (scp cannot b...
question Insufficient memory when docker installs...
Today a junior student asked a question. The HTML...
Mysql installation, configuration, and optimizati...
Table of contents Why understand the life cycle W...