Now there are more and more professional websites, many netizens build their own small house online. However, Xin Xi's hard-working page is a very painful thing, so everyone wants to protect their own original works, lock the lock on their own web, let me take you to our understanding how to give us Web pages plus a password lock.
First, often use JavaScript password lock
1. Learn from JavaScript
JavaScript is a new web description language, which is developed by Sun Company and Netscape, Netscape, which can be embedded in the HTML file, using it to design interactive web content.
2. JavaScript Features
It is very simple to use JavaScript, just a small code, you can make web pages have a misery effect, and how to encrypt the JavaScript is the most commonly used method in the network.
3. Encryption using JavaScript
The easiest result using JavaScript encryption is to let the viewer unable to use the mouse button, when he clicks right click to save or copy the text, a warning window is popped up or pops up.
Implementation:
(1) To block the mouse button with the pop-up window
Put the following code in the
head> flag of the web page HTML code, you can realize the right button to encrypt the web page.Function Click () {if (event.button == 2) {alert ('This site is not allowed to use the right button,
Use the left button! ^ _ ^ ')}}}}
Document.οnmοusedοwn = Click script>
(2) Bounce up "Add Favorites" to block the mouse button
Put the following code in the
head> flag of the HTML code of the web page. Implement the "Add to Favorites" option with right click.Function Click () {if (Event.Button == 2) {Window.external.Addfavorite
('http://www.yesky.com/,' Tianji Net ')}}
Document.οnmοusedοwn = Click script>
(3) Thoroughly block the mouse button to place the following code on the
head> flag of the HTML code of the web page, it is possible to completely block the right button, because this script calls a function when the right button is pressed, so It can be changed to many types. Even if the left button is pressed, press the right button, let go the left button, and the method of letting the right click is still cracking.