Cordova InAppBrowser and <a target=“_blank”> not working

ⅰ亾dé卋堺 提交于 2019-12-23 20:03:08

问题


I am using Cordova 3.4.1 on iOS with the InAppBrowser plugin version 0.4.0.

When I have an <a href="...." target="_blank"> element, it is supposed to open in the InAppBrowser but it doesn't. Instead in replaces my app in the CordovaWebView and I have no way of getting back to the app.

if I do window.open it seems to work fine, but it isn't really feasible for me to add onclick handlers to all my links to then open them up in the InAppBrowser.


回答1:


This seems to be by design as per this bug... https://issues.apache.org/jira/browse/CB-6747




回答2:


To open in the InAppBrowser your link needs to be formatted like this<a href="#" onclick="window.open('http://myurl.com', '_blank', 'location=no');">. I hope that helps.




回答3:


Try using the target="_system" which should use the device's default browser



来源:https://stackoverflow.com/questions/23835720/cordova-inappbrowser-and-a-target-blank-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!