Start New Discussion within our Web Development Community

Hello. I have a function that checks the internet connection. I need to set a timeout to it. I have tried without success to do that. Please help. Here is the function:

function isOnline() {
        var uri = baseUrl+'ping';
        var xhr = new XMLHttpRequest();'GET',uri,false);
            return true;
            return false;
        return false;

This article has been dead for over six months. Start a new discussion instead.