Hur gör man för att få in nyare mac OS och webbläsaren Safari i detta scriptet:
' Hämta användarens webbläsare.
Function getBrowser()
Dim Browser, ua
ua = Request.ServerVariables("HTTP_USER_AGENT")
If Instr(ua, "MSIE") Then
If Instr(ua, "MSIE 6.") Then
Browser = "Microsoft Internet Explorer 6.x"
ElseIf Instr(ua, "MSIE 5.") Then
Browser = "Microsoft Internet Explorer 5.x"
ElseIf Instr(ua, "MSIE 4.") Then
Browser = "Microsoft Internet Explorer 4.x"
ElseIf Instr(ua, "MSIE 3.") Then
Browser = "Microsoft Internet Explorer 3.x"
If Instr(ua, "MSIE 3.02") Then
Browser = "Microsoft Internet Explorer 3.02"
End If
Else
Browser = "Microsoft Internet Explorer"
End If
ElseIf Instr(ua, "Mozilla") and Instr(ua, "compatible") = 0 Then
If Instr(ua, "Netscape6") Then
Browser = "Netscape Navigator 6.x"
ElseIf Instr(ua, "Mozilla/4") Then
Browser = "Netscape Navigator 4.x"
ElseIf Instr(ua, "Mozilla/3") Then
Browser = "Netscape Navigator 3.x"
Else
Browser = "Netscape Navigator"
End If
ElseIf Instr(ua, "Opera") Then
Browser = "Opera"
End If
getBrowser = Browser
End Function
'Hämta användarens operativsystem.
Function getOS()
Dim System, ua, os
ua = Request.ServerVariables("HTTP_USER_AGENT")
os = Request.ServerVariables("HTTP_UA_OS")
If Instr(ua, "Windows 95") Or Instr(ua, "Win95") Then
System = "Windows 95"
ElseIf Instr(ua, "Win 9x 4.90") Then
System = "Windows ME"
ElseIf Instr(ua, "Windows 98") Or Instr(ua, "Win98") Then
System = "Windows 98"
ElseIf Instr(ua, "Windows 3.1") Or Instr(os, "Win16") Then
System = "Windows 3.x/Windows NT 3.x"
ElseIf Instr(ua, "NT 5.1") Or Instr(oa, "NT 5.1") Then
System = "Windows XP"
ElseIf Instr(ua, "NT 5") Or Instr(oa, "NT 5") Then
System = "Windows 2000"
ElseIf Instr(ua, "NT") Or Instr(oa, "NT") Then
System = "Windows NT"
ElseIf Instr(ua, "Mac") Then
System = "Mac"
If Instr(ua, "PowerPC") Or Instr(ua, "PPC") Then
System = "Mac PPC"
ElseIf Instr(ua, "68000") Or Instr(ua, "68K") Then
System = "Mac 68K"
End If
ElseIf Instr(ua, "Linux") Then
System = "Linux"
ElseIf Instr(ua, "X11") Then
System = "UNIX"
End If
getOS = System
End Function
Det här borde funka (hoppas att det var okej att jag indenterade koden en aning, man vill ju gärna kunna läsa den...)
' Hämta användarens webbläsare.
Function getBrowser()
Dim Browser, ua
ua = Request.ServerVariables("HTTP_USER_AGENT")
If Instr(ua, "MSIE") Then
If Instr(ua, "MSIE 6.") Then
Browser = "Microsoft Internet Explorer 6.x"
ElseIf Instr(ua, "MSIE 5.") Then
Browser = "Microsoft Internet Explorer 5.x"
ElseIf Instr(ua, "MSIE 4.") Then
Browser = "Microsoft Internet Explorer 4.x"
ElseIf Instr(ua, "MSIE 3.") Then
Browser = "Microsoft Internet Explorer 3.x"
If Instr(ua, "MSIE 3.02") Then
Browser = "Microsoft Internet Explorer 3.02"
End If
Else
Browser = "Microsoft Internet Explorer"
End If
ElseIf Instr(ua, "Mozilla") and Instr(ua, "compatible") = 0 Then
If Instr(ua, "Netscape6") Then
Browser = "Netscape Navigator 6.x"
ElseIf Instr(ua, "Mozilla/4") Then
Browser = "Netscape Navigator 4.x"
ElseIf Instr(ua, "Mozilla/3") Then
Browser = "Netscape Navigator 3.x"
Else
Browser = "Netscape Navigator"
End If
ElseIf Instr(ua, "Opera") Then
Browser = "Opera"
Elseif Instr(ur, "Safari") Then
Browser = "Safari"
End If
getBrowser = Browser
End Function
'Hämta användarens operativsystem.
Function getOS()
Dim System, ua, os
ua = Request.ServerVariables("HTTP_USER_AGENT")
os = Request.ServerVariables("HTTP_UA_OS")
If Instr(ua, "Windows 95") Or Instr(ua, "Win95") Then
System = "Windows 95"
ElseIf Instr(ua, "Win 9x 4.90") Then
System = "Windows ME"
ElseIf Instr(ua, "Windows 98") Or Instr(ua, "Win98") Then
System = "Windows 98"
ElseIf Instr(ua, "Windows 3.1") Or Instr(os, "Win16") Then
System = "Windows 3.x/Windows NT 3.x"
ElseIf Instr(ua, "NT 5.1") Or Instr(oa, "NT 5.1") Then
System = "Windows XP"
ElseIf Instr(ua, "NT 5") Or Instr(oa, "NT 5") Then
System = "Windows 2000"
ElseIf Instr(ua, "NT") Or Instr(oa, "NT") Then
System = "Windows NT"
ElseIf Instr(ua, "Mac") Then
System = "Mac"
If Instr(ua, "PowerPC") Or Instr(ua, "PPC") Then
System = "Mac PPC"
ElseIf Instr(ua, "68000") Or Instr(ua, "68K") Then
System = "Mac 68K"
ElseIf Instr(ua, "Mac OS X") Then
System = "Mac OS X"
End If
ElseIf Instr(ua, "Linux") Then
System = "Linux"
ElseIf Instr(ua, "X11") Then
System = "UNIX"
End If
getOS = System
End Function