I'm planing to develop mobile version for my website, I need to consider all the devices like with different screen dimensions. I tried to find out a way to get the real estate width of mobile devise to shoe my mobile site accordingly, can anybody please suggest a solution for this problem. I'll be very happy if I got some solution to this problem using jQuery or PHP because I'm using these to develop my mobile website.
Asked
Active
Viewed 649 times
0
-
possible duplicate of [Get the browser viewport dimensions with Javascript](http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript) – Dan Grossman Feb 04 '11 at 05:44
-
@Dan: jQuery width() and height() functions are not giving correct values for mobile devises. I want to know the exact dimensions of devise screen from which user is accessing my website but not the window sizes. Is there any way for this? – Siva Feb 04 '11 at 07:08
1 Answers
5
Instead of using JavaScript, use CSS3 media queries to target different screen sizes, for example:
<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" />
Update: If really necessary, use screen.width
and screen.height
to access the width and height of the screen.

yuxhuang
- 5,279
- 1
- 18
- 13
-
thanks yuxhuang, actually I want to find out the exact dimensions of of the devise screen from which user is accessing my website. Do you know how to get those dimensions? – Siva Feb 04 '11 at 07:10
-