Ionic open link of iframe in system browser

I have an ionic 3 app, in which i get a script that makes an iframe in my content. The iframe has an anchor and when i click, i want the link to open in system browser.

The problem is that i cannot change the contents of the tag which is in the iframe - I can reach it with several getElementsByTagName but i cannot change it and do something like:

<a href="#" window.open(url)><img src="something" /></a>

Is there any way to open the links in system browser?

Please help me i lost my sleep for 4 days now.

Not 100% sure I understand what you are doing here, but if you need to communicate between an iframe and its parent you can use postMessage: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Once you have the iframe communicating with the rest of your app you can do whatever you like.

Thank you Josh for yor reply. My problem is this: I get a script from a server that creates an iframe in my content. The iframe has a banner and when the user clicks it opens a new webpage. My problem is that this webpage opens on top of my view without any toolbar or back button or close button. So in android when the user press the back button returns in the app, but in ios there is no back button so the user cannot return back.

Today, I have successfully done this. Using “cordova-plugin-inappbrowser”

https://www.npmjs.com/package/cordova-plugin-inappbrowser

using
var ref = cordova.InAppBrowser.open(‘http://apache.org’, ‘_system’, ‘location=yes’);

_system will open it in System browser.

Hopefully it helps.