lbod edited a comment on issue #540:
URL: 
https://github.com/apache/cordova-plugin-inappbrowser/issues/540#issuecomment-820461703


   Woops, I left a comment on the wrong ticket but yes I'm seeing the exact 
same behaviour 
https://github.com/apache/cordova-plugin-inappbrowser/issues/571#issuecomment-820439266
   I'll delete that and add in my comments here
   
   
   Has anyone had any sort of success with this? I've just ran into the same 
issue, however the solution recommended by @wvengen is not relevant, nor does 
it fix it. We had already ran into a similar issue when using the `message` 
event after launching a system window, so we already were unsubscribing then 
resubscribing to reattach event handlers.
   
   We too also want to intercept all navigation changes and conditionally load 
the system browser. I went back to basics and did a basic test without any 
system window and the `beforeload` event fires every second time as soon as you 
use `_loadAfterBeforeload()` to continue the URL navigation.
   
   **The code below fires the `beforeload` event on every navigation change**
   
   ```
     public openIAB(evt: Event) {
       const options: InAppBrowserOptions = {
         beforeload: 'yes'
       }
       const inAppBrowserRef = this.inAppBrowser.create(this.url, '_blank', 
options);
       inAppBrowserRef.show();
       inAppBrowserRef.on('beforeload').subscribe((resp) => {
         console.log(`===> beforeload resp.url (${resp.url});`)
       });
     }
   ```
   
   **The code below fires the `beforeload` event every second navigation 
change**
   
   ```
     public openIAB(evt: Event) {
       const options: InAppBrowserOptions = {
         beforeload: 'yes'
       }
       const inAppBrowserRef = this.inAppBrowser.create(this.url, '_blank', 
options);
       inAppBrowserRef.show();
       inAppBrowserRef.on('beforeload').subscribe((resp) => {
         console.log(`===> beforeload resp.url (${resp.url});`);
         if (resp.url.startsWith(this.baseUrl)) {
           console.log(`===> beforeload matched baseUrl, calling 
_loadAfterBeforeload() `);
           inAppBrowserRef._loadAfterBeforeload(resp.url);
         } else {
           console.log(`===> beforeload not matched baseUrl, do nothing`);
         }
       });
     }
   ```
   
   This only effects Android, the IOS plugin works fine. I've also tried with 
the latest version 5.0.0, we were using 4.1.0. I've tried to debug 
InAppBrowser.java and try get an understanding what's going on but my knowledge 
of Android isn't good enough to understand.
   
   There seems to be lots of bugs raised for very similar issues and this issue 
was raised a year and a half ago with no solution so I'm not holding out much 
hope unless I'm able to figure out what's happening in the plugin itself, which 
I think I'd be unlikely to do. The only other option is to descope this 
requirement for Android
   
   
   
   


-- 
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