6. Switch the page to a new address on a regular basis
<Meta http-equiv = "refresh" content = "seconds; url = URL">
7. Close the window. This will not prompt you to close it directly:
Add the following code to the <body> area:
<Object ID = closes type = "application/X-oleobject" classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<Param name = "command" value = "close">
</Object>
<Script language = "JavaScript"> function shutwin () </SCRIPT>
<A href = "javascript: shutwin ();"> close this window </a>
Sometimes it's hard to write Program The code is copied by others, so it will be hard to understand. This is a trivial matter, but if Source code There are some content that you don't want others to know, such as passwords and actions. Once these are used, the consequences are sometimes unimaginable. Web page encryption is the problem we need to solve now. Next, I will introduce some simple preventive methods based on my experience in creating web pages.
1. Right-click prohibited
As you can see, you will surely think that many people have introduced this trick, and there are also many methods to crack it. But here I want to talk about another method, and I tried a lot of methods that could not be cracked. The details are as follows:
<HTML>
<Head>
<SCRIPT>
Function stop (){
Alert ("Can I crack it? ");
Return false;
}
Document. oncontextmenu = stop;
</SCRIPT>
<Boyd> you can right-click the key on the left of Shift + F10 and right CTRL to try it! Check whether the problem can be solved. ^ _ ^ </Body>
Let's try it and see if it can be cracked! You can use alert ("can you try to crack it? "); This sentence is removed, so that when you right-click, there will be no response, as if there is no right-click function.
2. Forbidden to view source code
We have disabled the right-click menu, but the source code can also be seen in the "source file" under the "View" menu. Here we will solve this problem:
In fact, you only need to use a webpage with the <frame> </frame> mark to achieve the goal.
<Frameset>
<Frame src = "the URL of the file you want to keep confidential">
</Frameset>
In this way, when someone uses "View" the "source file", the above Code is displayed, and your real file is escaped.
3. Save the ban
The above two steps show that your source code is safe, but don't forget that others can save your page and analyze it slowly. But don't worry. Let's solve this problem.
Add the following code to the webpage you want to keep confidential:
<NoScript> <IFRAME src = "/*. htm"> </iframe> </NoScript>
11. <input type = button value = view webpage source code
Onclick = "window. Location = 'view-Source: '+
'Http: // www.csdn.net/'">
12. How to use ASP to check whether the visitor has used an agent?
<% If request. servervariables ("http_x_forwarded_for") <> ""
Then
Response. Write "<font color = # ff0000> you have passed the proxy server ,"&
_
"The real IP address is
"& Request. servervariables (" http_x_forwarded_for ")
End if
%>
13. Obtain the absolute position of the control
// Javascript
<Script language = "JavaScript">
Function getie (e ){
VaR T = E. offsettop;
VaR L = E. offsetleft;
While (E = E. offsetparent ){
T + = E. offsettop;
L + = E. offsetleft;
}
Alert ("Top =" + T + "nleft =" + l );
}
</SCRIPT>
// VBScript
<Script language = "VBScript"> <! --
Function getie ()
Dim t, L, A, B
Set a = Document. All. img1
T = Document. All. img1.offsettop
L = Document. All. img1.offsetleft
While a. tagname <> "body"
Set a = A. offsetparent
T = T + A. offsettop
L = L + A. offsetleft
Wend
Msgbox "Top =" & T & CHR (13) & "Left =" & L, 64, "Get control position"
End Function
--> </SCRIPT>
14. The cursor stops at the end of the text box.
<Script language = "JavaScript">
Function CC ()
{
VaR E = event. srcelement;
VaR r = E. createTextRange ();
R. movestart ('character ', E. value. Length );
R. Collapse (true );
R. Select ();
}
</SCRIPT>
<Input type = text name = text1 value = "123" onfocus = "CC ()">
15. determine the source of the previous page
ASP:
Request. servervariables ("http_referer ")
Javascript:
Document. referrer
16. Minimize, maximize, and close the window
<Object ID = HH1
Classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "minimize"> </Object>
<Object ID = HH2
Classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "maximize"> </Object>
<Object ID = hh3
Classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<Param name = "command" value = "close"> </Object>
<Input type = button value = minimized onclick = hh1.click ()>
<Input type = button value = maximized onclick = hh2.click ()>
<Input type = button value = Disable onclick = hh3.click ()>
This example applies to IE
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service