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

158
Views
iframe receives message from parent window but console.log returns [object MessageEvent]

I'm sending messages from the parent window to the iframe, but when I log the message inside the iframe, it returns [object MessageEvent].

I've tried to parse it with JSON.parse and it produces a parse error, but when I try JSON.stringify it prints the string representation of the message correctly.

Can I access the object without doing JSON.strinfigy?

From the Parent window, I'm not sending JSON string. I'm sending an object.

Below is my code in parent window

frame.contentWindow.postMessage({
  action: 'start', 
  config: {onlyWithImages}
}, '*')

and inside the iframe I've this code

window.addEventListener('message', e => {
  let data = e.data
  console.log(data) //[object MessageEvent]
}
about 4 years ago · Santiago Trujillo
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!