Page 1 of 1
offline event in pageshow
Posted: Thu Apr 16, 2015 9:32 am
by She
Hi Team,
Im trying to detect if there's internet or no internet when the user opened the application. so i input this code in pageshow event:
var online = window.navigator.onLine;
if (!online) {
alert('Check your internet.');
};
but nothings happen. I already tried the OFFLINE/ONLINE Event to the app to show the alert but still no luck. Thank you in advance.
please help.
Thank you.
offline event in pageshow
Posted: Thu Apr 16, 2015 10:08 am
by She
Try to open your app without internet connection. you can see the alert message will not show. we already tried this to 10 android devices. but still no luck
Thank you Team
offline event in pageshow
Posted: Thu Apr 16, 2015 10:37 am
by Alena Prykhodko
Hi,
Please use offline/online events to detect status http://devcenter.appery.io/documentat...
Works for me.It fires when status changes.
offline event in pageshow
Posted: Fri Apr 17, 2015 12:32 am
by She
Have you tried this?
close the app(totally closed)
off you internet connection
open the app again.
its not working here.
offline event in pageshow
Posted: Fri Apr 17, 2015 6:17 pm
by Serhii Kulibaba
Hello,
Events online/offline work when Internet connection status changes. If you want just to know the current Internet connection status - execute any REST service. If it will fire the "success" event - connection is active, if "error" - unactive;
offline event in pageshow
Posted: Wed Feb 17, 2016 2:34 am
by Taiye
Hello guys,
For some reasons, the online/offline events are not firing on my android 4.2.2 device (nothing fancy, just printing a simple alert from a javascript handler when i disable/enable my connectivity). however, the same test works perfectly on ios9 for online/offline events.
I am only pointing this out for information purposes as I've been able to overcome the challenge using the tip described here...
http://www.raymondcamden.com/2015/01/13/phonegap-onlineoffline-tip-2/
Thanks
Taiye
offline event in pageshow
Posted: Wed Feb 17, 2016 10:37 am
by Serhii Kulibaba
Thank you for update! Glad it works now!