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?
答案 0 :(得分:0)
我发现的一种方式是使用白名单插件:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/
如果您可以制作白名单模式,以使iframe中的所有链接都针对该模式,则它们将在iOS的外部浏览器中打开。
不幸的是,默认情况下,这不适用于Android,尽管您有权访问并可以添加
<base target="_blank"/>
访问iframe中的页面,那么它也将适用于Android。