breautek commented on issue #835:
URL: 
https://github.com/apache/cordova-plugin-inappbrowser/issues/835#issuecomment-753492947


   Have you tried attaching the 
[backbutton](https://cordova.apache.org/docs/en/dev/cordova/events/events.html#backbutton)
 listener?
   
   I'm not sure if this will work when the inappbrowser is active, but you 
could try hooking into that event to call the JS `hide` api on your browser 
reference.
   
   ```javascript
   
   document.addEventListener('backbutton', function () {
       var ref = getBrowserReferenceSomehow();
       if (ref) {
          ref.hide();
       }
       else {
           window.history.back();
       }
   });
   ```
   
   > Is there any way to directly call the Javascript Cordova .hide 
inAppBrowser function from within the Java file?
   
   The only way this is possible is if you fork and maintain your own version 
of this plugin, which I personally wouldn't recommend. When you call the JS 
`hide` api, it will reach:
   
   
https://github.com/apache/cordova-plugin-inappbrowser/blob/8bdbd18d1619e25cf8bdedadf6448ef40b21ea7c/src/android/InAppBrowser.java#L329-L341
   
   You could probably modify this and abstract it so you can call the hide 
method from elsewhere within the native code side.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to