Getting URL of InAppBrowser in angularjs, Ionic

Previously I had written a post regarding how to use the Apache Cordova InAppBrowser plugin to launch external URLs in an Ionic Framework application.  This previous post was basic and was only enough to get you started.

This tutorial assumes you’ve read my previous post and are comfortable using the InAppBrowser.  If you are, continue to get the url of the Opened window view (browser) by using the event handling of browser (InAppBrowser).


$rootScope.$on('$cordovaInAppBrowser:loadstart', function(e, event));

Listen for the loadstart event, called when the In App Browser starts loading a page (only after open() is called).


Injects JavaScript code into the InAppBrowser window

$cordovaInAppBrowser.executeScript(details, callback);
  • injectDetails: details of the script to run, specifying either a file or code key. (Object)
    • file: URL of the script to inject.
    • code: Text of the script to inject.
  • callback: the function that executes after the JavaScript code is injected.
    • If the injected script is of type code, the callback executes with a single parameter, which is the return value of the script, wrapped in an Array. For multi-line scripts, this is the return value of the last statement, or the last expression evaluated.

To handle the events of the Browser we can use :

Get URL fom InAppBrowser


$rootScope.$on('$cordovaInAppBrowser:loadstart', function (e, event) {
            code: "window.location.href"
            function (values) {                    
                $scope.bURL = values;


Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.