系统浏览器中的离子打开链接,不会更改<a> tag

时间:2018-05-11 14:58:21

标签: ionic3

I have an ionic 3 app, in which i get a script that makes an iframe in my content. When i click the i frame 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?

1 个答案:

答案 0 :(得分:0)

我发现的一种方式是使用白名单插件:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/

如果您可以制作白名单模式,以使iframe中的所有链接都针对该模式,则它们将在iOS的外部浏览器中打开。

不幸的是,默认情况下,这不适用于Android,尽管您有权访问并可以添加

<base target="_blank"/>

访问iframe中的页面,那么它也将适用于Android。