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

93
Views
Identify the sender-iframe from message when sandboxed

Fictional situation for simplification:

  • I have a grandparent page containing one parent iframe displaying the "parent page".
  • This "parent page" contains two children iframes childA and childB.
  • All the iframes are sandbox="allow-scripts" for security reasons.

parent sends and receive messages from/to grandparent, childA and childB.

When parent receives a message, I need to be able to identify the sender, but I can't find the right approach, as the origin of the event is null:

function onReceive(message) {
    // origin is null when the message comes from a sandboxed frame.
    console.log(message.origin);
}

Do you know a clean way to know who does the message come from?

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

0

OK, it was simpler than I expected. I actually can compare the message.source property with the contentWindow of the child iframes, or window.parent for the grand parent.

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!