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"
What I want?
href of specific links to redirect them to other URLtarget for specific links to _blankWhat 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.