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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -