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
Implementation of navigation bar, fixed top navig...
text OK, next it’s time to show the renderings. O...
Table of contents Preface 1. Use global unified o...
Table of contents Implementation effect diagram I...
Use the find command to find files larger than a ...
The temperament of a web front-end website is a fe...
Today I had a sneak peek at IE8 beta 1 (hereafter...
Today, I will answer these newbie questions: Build...
GNU Parallel is a shell tool for executing comput...
The most common, most commonly used and most gener...
This article example shares the specific code for...
The database, like the operating system, is a sha...
Table of contents Preface What is data binding? T...
This article example shares the specific code of ...
Nginx can use its reverse proxy function to imple...