I am trying to use the Page Visibility Api to detect when web content is being shown in iOS. I have simple JS:
window.addEventListener("pageshow", function(){ alert("page shown"); }, false);
The alert fires as expected in mobile safari when the tab is made active, or when safari is minimized and then re-shown.
However if I host the web content in a UiWebView, the event is not firing. Has anyone else encountered this issue? If so any work around for this?
Thanks...
The UIWebView dose not support that event however you could look into triggering the event your self from the app natively
This how you call a JavaScript function from Objective-C Objective C send data to phonegap and call javascript function
Then you just use the code above to notify the webview when your handling the application being started or restarted from suspension
Objective C: How to check if application is currently active (i.e. user is using it)? should help with that
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With