Skip to content

Instantly share code, notes, and snippets.

@weikinhuang
weikinhuang / gist:3266794
Created August 5, 2012 19:25
Get true viewport height in mobile browsers
var getUsableHeight = function() {
"use strict";
// check if this page is within a app frame
var isInAppMode = ("standalone" in navigator && navigator.standalone) || (window.chrome && window.top.chrome.app && window.top.chrome.app.isInstalled);
var ua = navigator.userAgent;
// memoized values
var isIphone = ua.indexOf('iPhone') !== -1 || ua.indexOf('iPod') !== -1;