Forum Moderators: open

Message Too Old, No Replies

different info for different browsers

         

hal12b

2:42 pm on Jun 30, 2010 (gmt 0)

10+ Year Member



Do you think this code is pretty solid, or would you recommend something else? It would happen on page load. I am just using the Response.write's as examples. Realistically, I would have blocks of code to execute.


<% If Request.Browser.Browser = "IE" Then
Response.Write("hello internet explorer")

ElseIf Request.Browser.Browser = "AppleMAC-Safari" Then

Response.Write("apple apple apple")

ElseIf Request.Browser.Browser = "Firefox" Then

Response.Write("fire!")
Else
'nothing

end if

%>

marcel

11:18 am on Jul 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There was a discussion here about this a while back, you can get some more info here:

Browser detection in .NET [webmasterworld.com]

Ocean10000

2:03 pm on Jul 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The code would work for those three browers but what about the other browsers out there?

I assume the browser statements are designed to handle the quirks for those browers.

[edited by: Ocean10000 at 3:04 am (utc) on Jul 2, 2010]

hal12b

5:33 pm on Jul 1, 2010 (gmt 0)

10+ Year Member



I'd let the "Else" statement handle the others. I can see from our stats that these three browsers make up like 99.76% of our traffic. Most Linux users are on Firefox.

It's just specific content that would be displayed, versions won't matter.