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

288
Visualizações
On Close of Alert Window navigate to HomeScreen JavaScript

Is there a way to navigate to the home screen when a js alert is closed?

So I have triggered an alert

.then((message) => alert("Bestellung wird bearbeitet")

& I want that you get redirected to the Home Screen when you press on the close button.

Is there a way to accomplish this behaviour?

I tried adding

window.location.href = 'index.html'

after the alert button, but I get redirected instantly, so the alert button doesn't even appear. But I want to be redirected after the alert button is closed.

The attempt:

function sendEmail() {
    Email.send({
      SecureToken: "a",
      To: "b",
      From: "c@gmail.com",
      Subject: "Bestellung",
      Body:
        "Body"
    }).then((message) => alert("Bestellung wird bearbeitet"), 
    window.location.href = 'index.html');
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As stated here the second arguments passed to then() it's the handler for the rejected case. You were passing a second argument using , instead of wrapping a sequence of statements in the closure function body.

This is the way for the second instruction to be executed after the user closed the alert dialog:

.then((message) => {
  alert("Bestellung wird bearbeitet");
  window.location.href = 'index.html';
}
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