Now professional website more and more, many netizens have built up their own home on the net. But the hard work of the Web page was taken to makeover is a very sad thing, so everyone wants to protect their original works, for their own web page lock, today let me take you to understand how to add a password to our web page lock.
First, commonly used JavaScript password lock
1. Learn about JavaScript
JavaScript is a new Web description language, developed by Sun and Netscape Netscape, which can be embedded in HTML files that allow you to design interactive Web content.
2. JavaScript features
Using JavaScript is very simple, just a small piece of code, you can make a strange effect on the Web page, and the use of JavaScript to encrypt the method is the most common method of encryption in the network.
3. Use JavaScript encryption
The simplest result of using JavaScript encryption is that the viewer cannot use the right mouse button, and when he clicks on the right button to save or copy the text, it pops up a warning window or pops up a Favorites folder.
Implementation method:
(1) The use of pop-up windows to block the right mouse button to put the following code in the Web page HTML code flag, you can lock the right button to encrypt the Web page.
(2) Pop-up "Add Favorites" block the right mouse button The following code is placed in the flag of the page's HTML code. Realize the "Add to Favorites" option on the right mouse click.
(3) Completely blockade the right mouse button The following code is placed in the flag of the HTML code of the Web page to achieve a complete blockade of the right mouse button, because the script calls a function when the right key is pressed, so it can be changed to many types. Even if you press the left button, and then press the right button, release the left button, and then release the right key method is still not cracked.
(4) Prohibit viewing of source files The following code is placed in the flag of the HTML code of the Web page to prevent viewing the source file with IE browsers.
(5) Use garbled display link, call address encryption. Use some functions to convert URL characters to ASCII to achieve the purpose of hiding the scripts such as link frame pages and *.js,*.asp. Returns the ASCII code escape (character), the ASCII code is%XX format, XX is hexadecimal, such as the space bar is%20. return character unescape (string)
Such as:
JavaScript can also use the call script to display page encryption, password verification, and other encryption methods, but because of the complexity of the code and not often used, here is not much to say.