phonegap在浏览器中打开链接 [英] phonegap open link in browser
问题描述
<a target="_blank" data-rel="external" href="http://www.kidzout.com">www.kidzout.com</a>
hey专家我使用phonegap 2.9.0和我使用上面的代码打开链接浏览器但它打开它在同一个应用程序......如何打开它safari浏览器?
hey experts i am using phonegap 2.9.0 and i am using the above code to open the link in the browser but it opens it in the same app...... how to open it safari browser?
它打开同一个应用程序中的网站,然后我无法回到应用程序,所以我需要删除该应用程序,然后再次安装.... 。
it opens the website in the same app and then i am unable to come back to the app, so i need to delete the app and install that again.....
推荐答案
如一个类似的问题,使用JavaScript用 target
调用 window.open
参数设置为 _system
,根据 InAppBrowser文档:
As suggested in a similar question, use JavaScript to call window.open
with the target
argument set to _system
, as per the InAppBrowser documentation:
<a href="#" onclick="window.open('http://www.kidzout.com', '_system');">www.kidzout.com</a>
这应该工作,虽然一个更好和更灵活的解决方案将是拦截所有链接点击
事件,并从链接属性读取参数调用 window.open
。
This should work, though a better and more flexible solution would be to intercept all links' click
events, and call window.open
with arguments read from the link's attributes.
请记住,您必须安装InAppBrowser插件才能正常工作。
cordova plugin add cordova-plugin-inappbrowser
这篇关于phonegap在浏览器中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!