asp.net - How to Check Server Connectivity in javascript -


in asp.net application, having form different controls , after filling form, when click save button, if server connection available, datas has saved directly sql server , if connectivity not available, datas has saved local indexeddb datatbase. , later, if connectivity becomes available, indexeddb datas should saved sql server , indexeddb datas should deleted upon successful insertion of datas in sql server. want know how check whether connectivity available or not???

you can use navigator.online check if online.

window.addeventlistener('load', function () {   function onlinestatuschanged(event) {     alert( 'now ' + navigator.online ? "online" : "offline" );   }   window.addeventlistener('online', onlinestatuschanged);   window.addeventlistener('offline', onlinestatuschanged); }); 

keep in mind not guaranteed correct.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -