<%
'If you have automatically switched to execute this condition statement
If bint (TRIM (Request ("SW")> 0 then
Session ("myscreenwidth") = bint (TRIM (Request ("SW ")))
Session ("myscreenheight") = bint (TRIM (Request ("sh ")))
Response. Redirect (Session ("fronturl "))
End if
If bint (Session ("myscreenwidth") = 0 then
If bint (TRIM (Request ("SW") = 0 then
Session ("fronturl") = geturl ()
End if
Response. Write ("<SCR" & "ept> ")
If instr (geturl (),"? ")> 0 then
Response. Write ("window. Location = '" & geturl () & "& SW =' + screen. Width + '& SH =' + screen. height ;")
Else
Response. Write ("window. Location = '" & geturl ()&"? Sw = '+ screen. Width +' & SH = '+ screen. height ;")
End if
Response. Write ("</scr" & "ept> ")
End if
%>
<% = "Your resolution is:" & SESSION ("myscreenwidth") & "*" & SESSION ("myscreenheight") %>
<%
'Below are several functions
Function bint (STR)
If isnumeric (STR) then
Bint = clng (STR)
Elseif isempty (STR) then
Bint = 0
Elseif isnull (STR) then
Bint = 0
Else
Bint = 0
End if
End Function
Function geturl ()
Surl = request. servervariables ("url ")
Squerystring = ""
For each X in request. querystring
Squerystring = squerystring & "&" & X & "=" & server. urlencode (Request (x ))
Next
If Len (squerystring)> 0 then
Squerystring = right (squerystring, Len (squerystring)-1)
Else
Squerystring = ""
End if
If Len (squerystring)> 0 then
Geturl = Surl &"? "& Squerystring
Else
Geturl = Surl
End if
End Function
%>
Display information about your browser:
<% = Reguest. servervariables ("http_user_agent") %>
Display the browser version:
<% Set BC = server. Createobject ("mswc. browsertype ")
Response. Write BC. Browser
Response. Write BC. Version
%> <%
Function browser (Info)
Info = request. servervariables ("http_user_agent") 'initializes info here, which can be assigned as other variables in actual applications.
If instr (Info, "MSIE 7")> 0 then
Browser = "Internet Explorer 7.0"
Elseif instr (Info, "MSIE 6")> 0 then
Browser = "Internet Explorer 6.0"
Elseif instr (Info, "MSIE 5.5")> 0 then
Browser = "Internet Explorer 5.5"
Elseif instr (Info, "MSIE 5.0")> 0 then
Browser = "Internet Explorer 5.0"
Elseif instr (Info, "MSIE 4")> 0 then
Browser = "Internet Explorer 4.0"
Else
Browser = "unknown browser! "
End if
Response. Write "your browser is:" & browser & "<p>"
End function system (Info)
Info = request. servervariables ("http_user_agent ")
If instr (Info, "nt 5.1")> 0 then
System = "Windows XP"
Elseif instr (Info, "NT 5.0")> 0 then
System = "Window 2000"
Elseif instr (Info, "NT 4")> 0 then
System = "Windows NT"
Elseif instr (Info, "98")> 0 then
System = "Windows 98"
Elseif instr (Info, "me")> 0 then
System = "Windows Me"
Elseif instr (Info, "95")> 0 then
System = "Windows 95"
Else
System = "unknown operating system! "
End if
Response. Write "your operating system is:" & System & "<p>"
End function call browser (Info)
Call System (Info) %>