Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting URL of InAppBrowser

Tags:

cordova

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

like image 957
Publicus Avatar asked Jul 30 '13 15:07

Publicus


People also ask

How do I hide my URL in InAppBrowser?

you can hide the toolbar using the 'toolbar' option. you just need to set location to no and it'll hide the URL bar.

What is InAppBrowser in Android?

The InAppBrowser is a web browser view that displays when calling [window. open](window. open. html)() , or when opening a link formed as <a target="_blank"> . var ref = window.

What is InAppBrowser?

Introducing InAppBrowser.com, a simple tool to list the JavaScript commands executed by the iOS app rendering the page. To try this this tool yourself: Open an app you want to analyze. Share the url https://InAppBrowser.com somewhere inside the app (e.g. send a DM to a friend, or post to your feed)

What is Cordova plugin InAppBrowser?

We can define the InAppBrowser as a native Cordova plugin that mainly used to add an in-app browser for any of the hybrid mobile applications. By using the InAppBrowser, we can open an external link from the Cordova application. It can easily load a webpage inside the Cordova app.


1 Answers

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

like image 171
Leo Avatar answered Sep 24 '22 06:09

Leo