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

187
Views
window.addEventListener("message", getData); doesn't work in safari?

I am sending a postmessage from js script to iframe which is in react

// listensting to postMessage() function in react // React File

useEffect(() => {

function getData(e) {
  console.log("inside function");
  var origin = e.origin || e.originalEvent.origin;
  console.log("origin", origin);

  if (typeof e.data == "object" && "shopDomain" in e.data) {
    console.log(e.data);
  } else {
    console.log("not able to catch data");
  }
}
window.addEventListener("message", getData, false);
return () => {
  window.removeEventListener("message", getData, false);
};
}, []);

// JS File

let win = iframe.contentWindow;
win.contentWindow.postMessage(
  {
    customerId: customerId_rs,
    parentLocation: window.location.host,
  },
  "*"
);

Looked at various sites but can't find any solution. Have spent almost 10 hours at this any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

it seems like safari dont have the full support but it should support if you check the browser support of addEventListener you can see

  • options.passive parameter defaults to true for touchstart and touchmove events
  • options.passive parameter defaults to true for wheel and mousewheel events
  • options.signal parameter

these do not have support. you can read more about it here

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!