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

198
Views
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
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!