How can I get the cordova InAppBrowser to provide a way for the user to close the browser when using an Android device?

后端 未结 8 491
礼貌的吻别
礼貌的吻别 2020-12-13 04:57

I\'m using the cordova InAppBrowser to display content from an external site in my app. When I open the browser on an iPhone, there are some buttons at the bottom of the InA

8条回答
  •  孤城傲影
    2020-12-13 05:20

    For those of us using Ionic (ionicframework.com) and/or ngcordova (ngcordova.com). The following code will launch the inappbrowser and then close the dialog via a link close.

      $cordovaInAppBrowser.open('http://localhost:3000/#/mypath/', '_blank', options).then((event) ->
        # success
        return
        ).catch (event) ->
          # error
          return
    
      $rootScope.$on '$cordovaInAppBrowser:loadstart', (e, event) ->
        $log.log 'loadstart', e, event
        if event.url.match('mobile/close')
          $cordovaInAppBrowser.close()
    

提交回复
热议问题