Getting URL of InAppBrowser

cordova

Solution

Using 3.1 it is fairly simple

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); });

see the cordova docs for more info Cordova docs

Problem

Using InAppBrowser I wish to get the URL of the site the user is currently on, when he chooses to close the InAppBrowser. Adding an eventlistener for the exit event doesn't seem to return the 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? Using PhoneGap 2.8.0

Original source