Forum Moderators: open

Message Too Old, No Replies

code to display certain messages based on browser/operating system

         

hal12b

1:13 pm on Aug 19, 2010 (gmt 0)

10+ Year Member



Hi all - I had asked a similar question a while back, but need a little more info. I am working on a few sites and want to display certain information to users using mobile devices and everything else to people who access the site traditionally through a desktop or laptop (they'd be using IE, FireFox, Safari, etc..). The mobile users will be using Droid, and Ipod/Iphone/Ipad, and maybe blackberry and other mobile devices. My pages are in Classic ASP, some in ASP.net

marcel

1:30 pm on Aug 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can query the UserAgent with the following code:
Request.ServerVariables("HTTP_USER_AGENT")


Here's a good article on Performing Browser Detection [4guysfromrolla.com]

hal12b

5:10 pm on Aug 19, 2010 (gmt 0)

10+ Year Member



Maybe I should be trying to detect browser pixel size instead? Would it be safe to assume anybody with less than 400 pixels is on a mobile device, maybe except for maybe an iPad?

Ocean10000

4:28 am on Aug 20, 2010 (gmt 0)

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



If you can detect ipad/iphone/itouch those screens are a standard size. As for other mobile devices that is more of a crapshoot to get the correct size of the screen. Some newer mobiles phone browser do support javascript so you can detect a certain amount of information that way in conjuntion with browser sniffing.