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

207
Visualizações
Edit attribute of element in nested iframe react-native-webview

Scenario:
I'm using react-native-webview to load HTML which contains iframe and there is another iframe in that iframe (nested iframe) I've attached HTML. There are number of links in inner iframe with same and different domains with attribute target="_self"

enter image description here

What I want?

  1. Change href of specific links to redirect them to other URL
  2. Change target for specific links to _blank

What I tried?

function checkIframeLoaded() {
 const iframe = document.getElementsByTagName('iframe')[0];
 const iframeDoc = iframe.contentWindow.document; // working fine for this line
    
 if (iframeDoc.readyState  == 'complete') { // getting true
  const childiFrame = iframeDoc.getElementsByTagName('iframe');
  alert(childiFrame?.length) // always getting 0
  return; 
 } 
 window.setTimeout(checkIframeLoaded, 100);
}
document.body.onload = function(){
 checkIframeLoaded();
}

Injected JS this JS to webview but getting alert always 0 ( means can't access anything inside outer iframe, I event tried getting div ),

Tried prop mixedContentMode={'always'} and added NSCrossWebsiteTrackingUsageDescription in info.plist to avoid cross-origin issue.

Let me know what more info I should provide to understand the problem better.

Thanks in advance for help.

about 4 years ago · Juan Pablo Isaza
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