Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
Send messages between apps within same browser window

I have two separate web apps, an angular parent app and a react child app. The parent app is loading the child app in an iframe. I am trying to have these apps talk to each other using window.postMessage() but either the message isn't being properly sent or it isn't being received.

Here is exactly what I've tried.

Parent App:

window.postMessage(message, "*")

Child App:

window.addEventListener("message", (event) => {
     console.log(event)
}

The only thing I have to go off of is when I console log the window on the parent, I see:

postMessage: f postMessage: ()
   length: 1
   name: "postMessage"
   arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not 
               be accessed on strict mode functions or the arguments objects for calls to       
               them at Function.s (<anonymous>:1:83)]
   caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not 
               be accessed on strict mode functions or the arguments objects for calls to       
               them at Function.s (<anonymous>:1:83)]
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The parent must dispatch the message from the window of the target (child process, iframe in your case) not from the window object of the parent:

const child = document.querySelector('iframe').contentWindow;
child.postMessage(message, "*")

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda