ASP to get screen resolution

Source: Internet
Author: User

<%
'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) %>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.