kwilliams
06-01-2005, 12:33 PM
I'm using the following server-side script to pull the users browser type, and assign the appropriate CSS stylesheet for that user:
<%
'***Browser selector begins***
'Display stylesheet depending on browser
Dim browser, stylesheet
browser = Request.Browser.Type
'Internet Explorer browser check
if browser = "IE5" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ie5.css' />"
else if browser = "IE" or browser = "IE3" or browser = "IE4" or browser = "IE6" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ie6.css' />" 'default ie stylesheet
'Gecko-based browser check
else if browser = "Netscape5" or browser = "Netscape6" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ns56.css' />"
else if browser = "Netscape7" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ns7.css' />"
else if browser = "Netscape" or browser = "Netscape8" or browser = "Mozilla" Then
stylesheet = "<link rel='stylesheet' href='styles/css/mz1.css' />" 'default ns stylesheet
else if browser = "Opera7" Then
stylesheet = "<link rel='stylesheet' href='styles/css/op7.css' />"
else if browser = "Opera" or browser = "Opera8" Then
stylesheet = "<link rel='stylesheet' href='styles/css/op8.css' />" 'default op stylesheet
else
stylesheet = "<link rel='stylesheet' href='styles/css/default.css' />" 'default main stylesheet
end if
Response.Write(stylesheet)
'***Browser selector ends***
%>
NOTE: I haven't started developing it for Mac's yet, as we only have a PC environment.
Everything works great, except that Netscape 8 and Mozilla Firefox both show up as Netscape 5 when using the "Request.Browser.Type" method (huh???). This of course results in my stylesheet for NS 5 instead of my stylesheet for NS 8.
So here are my questions:
1) Why would both of these browsers show up as NS 5 with the "Request.Browser.Type" method?
2) Once I'm hopefully able to pull NS 8/Mozilla, is there a way to specify between NS 8 and Mozilla Firefox?
I hope to hear from someone soon, as I'm kinda lost on this one. Thanks.
<%
'***Browser selector begins***
'Display stylesheet depending on browser
Dim browser, stylesheet
browser = Request.Browser.Type
'Internet Explorer browser check
if browser = "IE5" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ie5.css' />"
else if browser = "IE" or browser = "IE3" or browser = "IE4" or browser = "IE6" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ie6.css' />" 'default ie stylesheet
'Gecko-based browser check
else if browser = "Netscape5" or browser = "Netscape6" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ns56.css' />"
else if browser = "Netscape7" Then
stylesheet = "<link rel='stylesheet' href='styles/css/ns7.css' />"
else if browser = "Netscape" or browser = "Netscape8" or browser = "Mozilla" Then
stylesheet = "<link rel='stylesheet' href='styles/css/mz1.css' />" 'default ns stylesheet
else if browser = "Opera7" Then
stylesheet = "<link rel='stylesheet' href='styles/css/op7.css' />"
else if browser = "Opera" or browser = "Opera8" Then
stylesheet = "<link rel='stylesheet' href='styles/css/op8.css' />" 'default op stylesheet
else
stylesheet = "<link rel='stylesheet' href='styles/css/default.css' />" 'default main stylesheet
end if
Response.Write(stylesheet)
'***Browser selector ends***
%>
NOTE: I haven't started developing it for Mac's yet, as we only have a PC environment.
Everything works great, except that Netscape 8 and Mozilla Firefox both show up as Netscape 5 when using the "Request.Browser.Type" method (huh???). This of course results in my stylesheet for NS 5 instead of my stylesheet for NS 8.
So here are my questions:
1) Why would both of these browsers show up as NS 5 with the "Request.Browser.Type" method?
2) Once I'm hopefully able to pull NS 8/Mozilla, is there a way to specify between NS 8 and Mozilla Firefox?
I hope to hear from someone soon, as I'm kinda lost on this one. Thanks.