You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/11/06 20:52:31 UTC

[GitHub] [cordova-plugin-inappbrowser] Polantaris opened a new issue #571: 'beforeload' event can only fire once in an InAppBrowser session

Polantaris opened a new issue #571: 'beforeload' event can only fire once in an InAppBrowser session
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/571
 
 
   # Bug Report
   
   ## Problem
   When an InAppBrowser session is started, the 'beforeload' event will only ever trigger once. 
   ### What is expected to happen?
   Every time a redirect event is triggered from the InAppBrowser, 'beforeload' should trigger and run each time.
   ### What does actually happen?
   If the InAppBrowser session is not killed as a result of the 'beforeload' event, all attempts at redirect from that moment on do nothing. All URLs essentially break.
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   I have a SPA that gets accessed as part of my Cordova application. There are some URLs within that SPA that cannot be handled by Cordova's InAppBrowser (at least on Android) in any capacity. Any URL that does not use the HTTP protocol (for example, deep link URLs that use a different protocol) fail. As a result, I wanted to hook into the 'beforeload' event for two reasons:
   
   1. I can intercept this request to the URL the InAppBrowser cannot handle and redirect the user to that page using the system browser.
   2. I can prevent the user's SPA session from being killed off and having to be refreshed.
   
   Using the 'beforeload' event accomplishes both items. My InAppBrowser session switches to the System Browser, and if I back out of the System Browser or return to the application, the page stays where it was in the state it was in. However, from that moment on, every single link fails to work. I can no longer navigate in any capacity to any other URL. This makes the 'beforeload' event completely useless to me, because I need to be able to navigate to other locations.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   `
       inAppObj.addEventListener('beforeload', (event: any, callback: Function) => {
           let currentURL: string = event.url;
           if (currentURL.includes('someurl')) {
               cordova.InAppBrowser.open(currentURL, '_system');
           }
           else {
               callback(currentURL);
           }
       });
   `
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   This is specifically an issue that I've noticed on Android, as I am trying to fix an issue specific to Android.
   
   
   ### Version information
   `    "cordova": "9.0.0",
       "cordova-android": "8.1.0",
       "cordova-ios": "5.0.0",
       "cordova-browser": "6.0.0",
       "cordova-plugin-androidx": "1.0.2",
       "cordova-plugin-androidx-adapter": "1.1.0",
       "cordova-plugin-device": "2.0.3",
       "cordova-plugin-firebasex": "6.1.0",
       "cordova-plugin-inappbrowser": "3.1.0",
       "cordova-plugin-local-notification": "0.9.0-beta.2",
       "cordova-plugin-network-information": "2.0.2",
       "cordova-plugin-secure-storage": "3.0.2",
       "cordova-plugin-whitelist": "1.3.4"`
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org