jquery - Checking internet connection using JavaScript -
problem I want to show a warning that the Wi-Fi is off [I.e. no internet connection] In my webpage, I have lots of buttons, pop-ups, etc. Users can click on anything when offline. But I want to show that there is a failure in the API call or not. I can check "The alert should be shown when the call failed, which is caused by a user's action" such as Hello, I have made the following efforts: I used it as described below but it is not working I have written the references and something else Any suggestions? You can use the original and callbackFunction = function on your callback funciton (probably It's manipulating the dom, and also that the callback function, if defined outside of navigator.online in each click. But I do not want to type the function calls or the number of lines, is this a normal way to use jQuery, JS, Ajax?
$ Ajax with any error Should not be bound by the device / page.
Navigator.online // It works fine
. & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script & gt; & Lt; Script & gt; Window.jquire || Document.write ('& quot; script src = "js / vendor / jquery-1.10.2.min.js" & gt; & lt; / script & gt;') & lt; / Script & gt;
setInterval function here, for example, Use a set interval in your
function inside the document.ready function, or perhaps it is more ubiquitous when the page loads:
setInterval (callbackFunction :, 1000 / * and lieutenant; - Function in every interval MS * /);
setInteraval above):
If (navigator.oline) {// manipulate dom}};
document.ready () function. Remember to give > SetIntern () Greetings, probably should be declared first.
Comments
Post a Comment