Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
How can I catch a browser timeout and execute my own error message?

I have a web page (classic asp) with a link to a local IP address, as follows:

<a href="http://192.168.1.89">Link</a>

If the local IP address is unavailable the web browser eventually times out and displays its own error message.

What I want to do is: catch the timeout before the browser displays its default error page and display an error on the same web page, next to the "Link".

e.g. <a href="http://192.168.1.89">Well Pump</a><div id="timeoutmsg">offline</div>

I am guessing I need some JavaScript and the timeout function, but I don't know where to begin.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Found this awesome workaround using pure javascript, no JScript, no ajax, no external libraries.
Works at treat:
Just need to upload a "test.gif" file to the local site(s).

var url = 'http://192.168.1.89';
var img = new Image();
img.src = url + '/test.gif';
img.onload = function() {
    document.getElementById("msg").innerHTML = "";
    window.location.href = url;
}
img.onerror = function() {
    document.getElementById("msg").innerHTML = "offline";
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda