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

198
Views
Redirecting a parent page after receiving an event listener from an iframe

I have an iframe with a form, when the form is completed, it has an event listener sending the message "Successful". I then need to get the parent page to redirect to another page e.g "https://website.com/successful".

What else can I add in the JS code to make the parent page redirect once the message "Successful" loads within the iframe.

<script>
document.addEventListener('DOMContentLoaded', function () {
window.addEventListener('message', function (e) {
const data = JSON.parse(e.data);
console.log(data.message);
});
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can just use window.location.replace like

<script>
document.addEventListener('DOMContentLoaded', function () {
window.addEventListener('message', function (e) {
const data = JSON.parse(e.data);
console.log(data.message);
window.location.replace("https://website.com/successful");
});
</script>
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!