Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <20727073.rOyAWzDM7h@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Mon, 09 Jan 2012 14:02:37 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: Sizing on android phone Newsgroups: comp.lang.javascript Followup-To: comp.lang.javascript References: <2320864.tvUHyB9DHY@PointedEars.de> Supersedes: <1820649.LCz8dlRQS9@PointedEars.de> MIME-Version: 1.0 Lines: 36 NNTP-Posting-Date: 09 Jan 2012 14:02:37 CET NNTP-Posting-Host: a3ca8cc5.newsspool2.arcor-online.net X-Trace: DXC=:c04TC7Zi8Fgj[ZPFj7ehOA9EHlD;3YcB4Fo<]lROoRA8kFdWjfmTBDZm8W4\YJNL;?f@h5gMfbLBIlHSWN On 9/01/2012 10:15 PM, Thomas 'PointedEars' Lahn wrote: >> Andrew Poulos wrote: >>> I've a basic page which, onload, returns the viewport size. >>> >>> When I run the page on a Samsung GS it returns 450 x 320. >>> >>> [no code, no URL] > > I call this function: > > function getViewPort(win) { > win = win || window; > if (typeof win.document.clientWidth == "number") { > return [win.document.clientWidth, win.document.clientHeight]; > } else if (win.document.documentElement && > win.document.documentElement.clientHeight) { > return [win.document.documentElement.clientWidth, > win.document.documentElement.clientHeight]; > } else { > return [win.document.body.clientWidth, > win.document.body.clientHeight]; > } > } Obviously, checking the *document*, the *document element* or the *document body* will _not_ yield the *viewport* dimensions. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs,