title: Retrieving data from an inappbrowser
body: <p>I am currently building an Ionic hybrid application.</p>
  
  <p>Unfortunately, I am having difficulties accessing the response data of the request during the Facebook sign-up process. </p>
  
  <p>We want to retrieve data from an inappbrowser and are using Cordova's inappbrowser for a callback. Unfortunately we can't. What is the best way of accomplishing this?</p>
  
  <pre><code>function InAppBrowser($scope, $cordovaInAppBrowser, $rootScope, $http, $window) {
  
      var durr;
  
      $scope.facebook = facebook;
      $scope.foobar = foobar;
  
      function facebook() {
  
          var options = {
              location: 'no',
              clearcache: 'yes',
              toolbar: 'no'
          };
  
          durr = $cordovaInAppBrowser.open('https://www.facebook.com/dialog/oauth?scope=email,public_profile,user_friends,user_likes,user_photos,user_posts&amp;client_id={client_id}&amp;redirect_uri={callback_url}', '_blank', options)
          .then(function(e) {
              console.log(e);
          })
          .catch(function(e) {
              console.log(e);
          });
  
          $rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event) {
              $cordovaInAppBrowser.executeScript(
              { code: "localStorage.setItem('hurr', document.body.innerHTML)" },    
              function(data) {
                  console.log(data);
              });
          });
      }
  
      function foobar() {
          console.log(durr);
          // console.log(durr.localStorage.getItem('hurr'));
      }
  }
  </code></pre>