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

94
Visualizações
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 Respostas
Responde à pergunta

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 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