Classic ASP <object> and Windows Versions / Request.Servervariables("HTTP_USER_AGENT"
I am updateing an ASP Classic website. ASP is definitely not my forte, but I have done a little.
I am trying to load objects one way for Windows 7+ and another way for Windows XP.
I use the CODEBASE for Windows XP, and not for Windows 7. Regardless of OS, the
first method appears to be used by the browser.
#1 Why is this?
#2 Is there a case where the browser downloads the control from the server if the CODEBASE tag is left off?
My understanding is that if you use the CODEBASE tag, then the browser checks the control version and if an old
version exists on the Client, downloads it from the server.
The following code displays "Windows 7" if viewed by a browser on a Windows 7 Client,
otherwise "Unknown".
Code:
Dim strAgent
strAgent = Request.Servervariables("HTTP_USER_AGENT")
Dim aryAgentElems, strOS, strOK
strOK = "False"
aryAgentElems = Split(strAgent, ";")
strOS = aryAgentElems(2)
If strcomp(trim(strOS),"Windows NT 6.1") = 0 Then
Response.Write("Windows 7")
else
Response.Write("Unknown")
End if
As you can see split converts the string into an array using the semicolon to parse out "tokens" or fields.
If I plug the code with the <object> tag, it should work the same way, but it doesn't
appear to. Why is that?
That is my question.
I appreciate the help!
Last edited by ahoodin; February 20th, 2013 at 12:01 PM.
Bookmarks