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 InAppBrowser for closing it or navigating back and forth. The InAppBrowser on an Android device has no such buttons and has no obvious way for the user to close the browser.
I know how to programmatically close the InAppBrowser, but how can the user close it when using an Android device?
I know the user can hit the hardware back button to close the browser, but (1) that's not intuitive - the back button typically means "go back a page", and (2) I'd eventually like to change the behavior of the back button to go back a page within the site that is displaying inside the InAppBrowser, rather than close the browser.
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 <a href="/mobile/close">close</a>
.
$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()