jquery - Get actual height of mobile device with Javascript -
is there way actual device height of android device in portrait mode in javascript/jquery? i'm using galaxy s advance android version 2.3.6
i've tried following options far:
screen.height window.innerheight document.documentelement.clientheight $(window).height()
all of options return 450px, not device height. pixel ratio 1.5, 450*1.5 = 675. actual device height should 800, i'm missing 125 pixels of address bar.
is there way calculate height of actual screen?
i know not 800, 800/1.5, 533.
thanks in advance :)
ps. sorry if there confusion, question website have test on android, not java application.
if want height value in pixels can use getsize:
display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); int height = size.y;
if you're not in activity can default display via window_service:
windowmanager wm = (windowmanager) ctx.getsystemservice(context.window_service); display display = wm.getdefaultdisplay();
before getsize introduced (in api level 13), use getheight methods deprecated:
display display = getwindowmanager().getdefaultdisplay(); int height = display.getheight(); // deprecated
Comments
Post a Comment