cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cordova-plugin-inappbrowser] jacobg edited a comment on issue #372: OverrideUserAgent changes user agent for Cordova view too
Date Thu, 30 Apr 2020 15:49:31 GMT

jacobg edited a comment on issue #372:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/372#issuecomment-621938359


   @faisakhtar Yes, I wrote a wrapper function that checks if in-app browser has been opened
at least once. If not, then it opens and closes the window one time, before opening it again.
It happens pretty fast, so it's not so noticeable.
   
   Here is example code. I modified it a little from my own application to make it more generic,
so there may be a typo.
   
   ```javascript
   ensureIabOpenedAtLeastOnce (args) {
     // cordova-plugin-inappbrowser seems to have a bug on iOS WkWebView with overriding user
agent first time
     // window is opened: https://github.com/apache/cordova-plugin-inappbrowser/issues/372#issuecomment-584930604
     if (!this.iabOpenedAtLeastOnce && isIos && window.cordova) {
       const win = openIabWindow[('about:blank'])
       win.addEventListener('loadstop', () => {
         win.addEventListener('exit', () => {
           openIabWindow(args)
         });
         win.close()
       })
     } else {
       openIabWindow(args)
     }
   }
   openIabWindow (args) {
     this.iabOpenedAtLeastOnce = true
     return window.open(...args)
   }
   ```


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



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


Mime
View raw message