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

509
Visualizações
Javascript method setTimeout() does not work well in Safari browser

I try to develop javascript codes that can give users a warning when the server too long to response the html form submitted. My codes works well in Chrome and Firefox desktop browser, but not in Safari desktop browser.
How to make this works in Safari ? Here are my codes:

<!DOCTYPE html>
<html>
<head>
   <meta charset="UTF-8"/>
   <script type="text/javascript">
      function handleTimeout() {
         document.getElementById("retryButton").disabled = false;
         document.getElementById("message").innerHTML = "Your card's bank 3DS OTP page might be having issue. Please \"Tap to retry\".";
      }
      function retry() {
         setTimeout(handleTimeout, 5000);
         submitForm();
      }
      function submitForm() {
         return new Promise(function(resolve, reject) {
            document.getElementById('requestForm').submit();
            resolve("done");
         });
      }
      function start() {
         document.getElementById("retryButton").disabled = true;
         setTimeout(handleTimeout, 5000);
         submitForm();
      }
      window.addEventListener('load', (event) => {
         start();
      });
   </script>
</head>
<body>
<form id="requestForm" method="post" action="http://localhost:10877/auth/pareq">
   <input type="hidden" name="PaReq" value="eyJ2ZXJzaW9uIjoiMS4wLjIiLC"/>
   <input type="hidden" name="uuid" value="ac456037-995b-4778-bba5-df614db7ebaa"/>
   <input type="hidden" name="Status" value="Y"/>
</form>
<div id="message">Processing OTP</div>
<p>Tap the button below to Retry</p><br/>
<button id="retryButton" onclick="retry();">Tap to retry</button>
</body>
</html>

Function handleTimeout() is not working in Safari but works well in Chrome and Firefox browser.
How to make function handleTimeout() works well in Safari?

about 4 years ago · Juan Pablo Isaza
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