Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile Safari window reports 980px

Tags:

jquery

mobile

Why does this report 980 on the iPhone 4? I thought it would be 960 or 640.

alert($(window).width());
like image 460
Chris McClellan Avatar asked Apr 01 '11 02:04

Chris McClellan


1 Answers

You're getting the default viewport setting. See Apple iOS docs - meta tag and search for 'viewport'.

Property Description

width The width of the viewport in pixels. The default is 980. The range is from 200 to 10,000. You can also set this property to the constants described in “number.” Available in iOS 1.0 and later.

To get the device width, as per the docs:

For example, to set the viewport width to the width of the device, add this to your HTML file:

<meta name="viewport" content="width=device-width" />
like image 183
typo.pl Avatar answered Oct 03 '22 13:10

typo.pl