Is there a way to catch failed to load resource: net::ERR_CONNECTION_REFUSED, I\'ve tried:
try {
$.post(\'\',{},function(res) {
}).fail(fun
You have access to online/offline in chrome.
var _Network_state = true;
function updateIndicator() {
// Show a different icon based on offline/online
if (navigator.onLine) { // true|false
// ... do other stuff
_Network_state = true;
} else {
// ... do other stuff
_Network_state = false;
}
console.info(_Network_state ? 'Online' : 'Offline');
}
// Update the online status icon based on connectivity
window.addEventListener('online', updateIndicator);
window.addEventListener('offline', updateIndicator);
updateIndicator();
Before call ajax, inspect "_Network_state"