Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!