c'è un modo per catturare failed to load resource: net::ERR_CONNECTION_REFUSED
, ho provato:Come catturare Net :: ERR_CONNECTION_REFUSED
try {
$.post('',{},function(res) {
}).fail(function (xhr, textStatus, errorThrown) {
xhr.textStatus = textStatus;
xhr.errorThrown = errorThrown;
console.log('fail',xhr);
// how to get the 'ERR_CONNECTION_REFUSED' or anything else as string?
});
} catch(e) {
console.log('catch',e);
}
fail funzione potrebbe prendere, ma ho avuto alcuna informazione circa l'errore, o è:
- ERR_NAME_NOT_RESOLVED
- ERR_CONNECTION_REFUSED
- ERR_BLOCKED_BY_CLIENT
- E RR_TUNNEL_CONNECTION_FAILED (quando si utilizza il proxy)
o qualsiasi altra cosa .. la domanda sarebbe, come ottenere il tipo di errore?
Non otterrete informazioni specifiche sull'errore, per intento (perché altrimenti potrebbe essere abusato per ottenere informazioni sulla rete interna dell'utente, ad esempio). – robertklep