Skip to content

Instantly share code, notes, and snippets.

@AbleOne
AbleOne / gist:986e022b2d14736c4032bf83ef39cb62
Created March 11, 2019 12:32 — forked from weikinhuang/gist:3266794
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;