1

I have a mobile website. I need to detect mobile web browsers by screen size or resolution and display the website accordingly.

Can anyone help with detecting web browser and screen size?

Also, how can I open my website according to the screen size?

sfarbota
  • 2,619
  • 1
  • 22
  • 30
Shivi
  • 1,075
  • 9
  • 24
  • 42

4 Answers4

1

I suspect that you don't mean a WAP browser but rather a mobile browser. (As you've tagged your question with iPhone & Android.)

You need to use a device capability database to do this on the server side.

There are lots of options (see other answers and link below), but as you're using ASP.NET, I'd recommend looking at http://51degrees.codeplex.com/. This uses WURFL data and is the defacto replacement for MDBF (which used to be the best asp.net solution).

More information on using the 51degrees solution can also be found in blog post by Scott Hanselman and Steve Sanderson.

There are lots of other similar questions about this here on SO: https://stackoverflow.com/search?q=detect+mobile+browser+capabilities

Community
  • 1
  • 1
Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
0

For the detection part, I recommend to use WURFL. There is also a similar question/answer on SO.

For the resize part, I recently did something similar for a web application of us. I tried to keep it really simple and make the elements floating/dynamic resizing.

To test it, there are several emulators available, I used those for BlackBerry, Android, and Windows 7 Phone.

Community
  • 1
  • 1
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
0

You can use DeviceAtlas for this: http://deviceatlas.com/

brasimon
  • 769
  • 2
  • 9
  • 22
0

I use Mobile Device Detection and Redirection from 51 degrees.

Here are the properties that you can use:

Request.Browser.IsMobileDevice
Request.Browser.ScreenPixelsHeight
Request.Browser.ScreenPixelsWidth
James Lawruk
  • 30,112
  • 19
  • 130
  • 137
  • 1
    The properties listed here are NOT always accurate. My Android device (moto-razor) throws a false for IsMobileDevice. Also, while debugging, my chrome browsers shows 640x480 for screen sized while maximized (Screen rez 1600 x 900 ) Word of warning! – Rex Whitten Dec 04 '12 at 17:25