获取InAppBrowser的URL [英] Getting URL of InAppBrowser

查看:94
本文介绍了获取InAppBrowser的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用InAppBrowser当用户选择关闭InAppBrowser时,我希望获取用户当前所在网站的网址。

Using InAppBrowser I wish to get the URL of the site the user is currently on, when he chooses to close the InAppBrowser.

为退出事件添加事件监听器似乎没有返回URL。

Adding an eventlistener for the exit event doesn't seem to return the URL.

我第一个想到的解决方法是订阅loadstart事件,并从那里获取URL,因此总是有最近URL。

My first thought for a workaround was subscribing to the loadstart event, and getting the URL from there, thus always having the "most recent" URL. However this doesn't always fire when the user presses the back-button.

任何想法如何解决这个问题?

Any ideas how to solve this?

使用PhoneGap 2.8.0

Using PhoneGap 2.8.0

推荐答案

使用3.1很简单

您只需在加载开始时添加事件。或负载停止。

you just add an event on load start. or load stop.

 var ref = window.open('http://apache.org', '_blank', 'location=yes');
 ref.addEventListener('loadstart', function() { alert(event.url); });

有关详情,请参阅cordova文档 Cordova文档

see the cordova docs for more info Cordova docs

这篇关于获取InAppBrowser的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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