I have an android app, and I want to add a function to check if the user is connected to the internet. If they are not, I display an alert and then want to redirect them away from a ‘page’. The problem is however that I am using a Jquery Mobile Multi-Page template. So technically I am not redirecting to a page, it is a div. My code is as the following:
networkState = navigator.network.connection.type;
if (networkState == Connection.NONE)
{
alert(‘No internet connection detected’);
window.location.href = “#seconddiv”
};
However this does not work, and if I set it as index.html it goes right back to the start of the app, which is not acceptable. Does anyone know how to just get it to redirect to a div?
Try the
$.mobile.changePagefunction: http://jquerymobile.com/test/docs/api/methods.html