Phonegap - 如何打开应用程序内的外部链接 [英] Phonegap - How to open external link inside the app

查看:123
本文介绍了Phonegap - 如何打开应用程序内的外部链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被卡住了。我正在开发一个iOS phonegap应用程序。在我的首页我有一个链接

I'm stuck. I'm working on a iOS phonegap app. On my homepage I have a link

<a href="http://www.mysite.com/file/news.html" rel="external" target="_system"><IMAGE></a>

并且我还将* mysite.com添加到Cordova.plist(ExternalHosts)。

And I have also added *mysite.com into the Cordova.plist (ExternalHosts).

但是当我点击链接,它会打开一个浏览器,并链接到那个页面。我试过target =_ self,但它不工作。

But when I click on the link it will open up a browser and link me to that page. I have tried target="_self", but it doesn't work. How to make it open the page within the app itself?

推荐答案

你可以使用这个javascript snip, p>

You can push it to browser using this javascript snip,

window.open("http://yourexternallink.com","_system");

即使您安装了inAppBrowser,也会将您带到浏览器。

Even if you have inAppBrowser installed, this will take you to browser..

如果您希望打开应用中的链接,您需要以下代码段:

If you wish to open the link inside your app, you need below snippet,

var onInApp = window.open('http://paymentpage.com', '_blank', 'location=no,hidden=yes,closebuttoncaption=Done,toolbar=no');

请确保您添加了 cordova插件add cordova-plugin-inappbrowser plugin ..

make sure that you added cordova plugin add cordova-plugin-inappbrowser plugin..

这篇关于Phonegap - 如何打开应用程序内的外部链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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