/* tested on the iPad and iPhone */ function getZoomFactor() { var deviceWidth, landscape = Math.abs(window.orientation) == 90 // workaround for strange screen.height on the iPhone (v3.1.3) if (window.screen.width == 320) deviceWidth = landscape ? 480 : 320 else deviceWidth = window.screen[landscape ? "height" : "width"] return deviceWidth / window.innerWidth }