简体   繁体   English

检查是否在inappbrowser中打开了url

[英]Check if url is open in inappbrowser

In my app i want to an webpage open a inappbrowser. 在我的应用程序中,我想要打开一个浏览器的网页。 The webpage i want to open have three sites. 我要打开的网页有三个站点。 The first which is opened with a link to the second site. 第一个打开,带有指向第二个站点的链接。 The second site with a link to the third side. 第二个站点带有指向第三侧的链接。

How can i check if the third page was opened on the inappbrowser and set then an value in local storage. 我如何检查第三页是否已在应用程序浏览器中打开,然后在本地存储中设置一个值。 I found a solution but its only to get data from the first page. 我找到了一个解决方案,但是它只能从第一页获取数据。

Better it would be if i can pass any data from the third page to Cordova app. 更好的是,如果我可以将任何数据从第三页传递到Cordova应用程序。

Thank for your help. 谢谢您帮忙。

To check if a page is opened in inappbrowser, you can check navigator.userAgent. 要检查是否在inappbrowser中打开了页面,可以检查navigator.userAgent。

By default, userAgent of inappbrowser contains "cordova". 默认情况下,inappbrowser的userAgent包含“ cordova”。

if (navigator.userAgent.indexOf("cordova") !== -1) {
  // do something here
}

and to pass value from inappbrowser to cordova app, you can refer to below link: 并将值从inappbrowser传递到cordova应用,您可以参考以下链接:

http://www.telerik.com/blogs/cross-window-communication-with-cordova's-inappbrowser http://www.telerik.com/blogs/cross-window-communication-with-cordova's-inappbrowser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM