简体   繁体   中英

jQuery - detect iPhone in-call status bar

As the title suggests, is there any way in jQuery to detect/determine whether the in-call status bar is visible (hence if the user's in a call) so I can make changes to the GUI of my iOS web app accordingly?

I realize "determine whether the user is in a call" might be impossible from javascript. I'm also aware of the fact that this can be done using Objective C and Phonegap/Cordova plugin. However, this is not the solution I'm looking for.

What I rather search for is a work around that determines this by some other parameters, for instance by measuring the hight of the status bar or orientation change event in any way. Any ideas?

PS. Please let me know if you would like to have a look a my so-far fruitless attempts.

Yep, thats how easy it was - just measure the canvas height! Assuming the user uses an iPhone:

var biggerStatusBar = false;
var screenHeight = window.screen.height;
var canvasHeight = $(document).height();
if(screenHeight-canvasHeight==40)
biggerStatusBar =true;

alert("in-call status bar active: " + biggerStatusBar);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM