arron
Posts: 0
Joined: Sun Nov 23, 2014 8:59 am

checking if internet connection exists and loading page if it does

I am trying to create a page which will check for an internet connection..

this is what I am hoping to do...

if (internet connection exists) {
navigate to page
}

if (internet connection exists) {
javascript error alert "no internet connection exists"
}

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

checking if internet connection exists and loading page if it does

Check out this tutorial:
http://devcenter.appery.io/tutorials/...

Basically paste the JS into a JS file and run 3 different events that each execute a function defined in the JS file. Device ready, deviceOnline and deviceOffline. Near lines 120 in the JS file, you will see. $('[dsid="footer"]').text('Online');

If you followed the whole tutorial then your footer will have the name "footer" and that code will change its text.

In an action that you want to execute, add JS on click event(or whatever it is):

var status = $('[dsid="footer"]').text();
if (status==="Online") {
Appery.navigateTo('page_name');
}

if (status==="Offline") {
alert( "no internet connection exists");
}

This should work for you, just follow the tutorial from the start and ignore the actual to do list parts.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

checking if internet connection exists and loading page if it does

Hello,

Thanks Matt,

Arron please pass that tutorial to understand how offline/online works.

Regards.

Return to “Issues”