phonegap 在浏览器中打开链接 [英] phonegap open link in browser

查看:40
本文介绍了phonegap 在浏览器中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a target="_blank" data-rel="external" href="http://www.kidzout.com">www.kidzout.com</a>

嘿专家,我使用的是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.....

推荐答案

a similar question,使用 JavaScript 调用 window.open,并将 target 参数设置为 _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'); return false;">www.kidzout.com</a>

这应该可行,但更好、更灵活的解决方案是拦截所有链接的 click 事件,并使用从链接属性读取的参数调用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆