cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

(android) Removed waitForBeforeload flag as it prevents beforeLoad from being called on every GET request

Open PDLMobileApps opened this issue 5 years ago • 7 comments
trafficstars

Platforms affected

Android

Motivation and Context

Resolves #686

Link to the issue: #686

Description

We removed waitForBeforeload flag as it prevents beforeLoad from being called on every GET request and it does not seem to have any meaningful use.

Testing

Testing was done manually as I am not sure how to automate it.

The following tests were executed for Android 7, 8, and 10.

Created a new Cordova test app using cordova-plugin-inappbrowser. Executed: cordova.InAppBrowser.open("https://www.hannaford.com", "_blank", "beforeload=get"); and verified beforeLoad gets called with every get request.

Executed: cordova.InAppBrowser.open("mailto:[email protected]", "_blank", "beforeload=get"); and verified beforeLoad gets called with that get request.

Checklist

  • [x] I've run the tests to see all new and existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [x] I've updated the documentation if necessary

PDLMobileApps avatar Jul 31 '20 18:07 PDLMobileApps

@wvengen originally implemented the beforeload feature and his PR comment indicates that waitForBeforeload is necessary.

have you got an opinion on this @wvengen?

dpa99c avatar Sep 01 '20 15:09 dpa99c

@wvengen originally implemented the beforeload feature and his PR comment indicates that waitForBeforeload is necessary.

have you got an opinion on this @wvengen?

We saw it was added on purpose and I believe it may had a specific goal. However, now it has the effect of preventing beforeLoad from being called on every GET request, which is quite a big deal. We removed it and we have been using the code in this PR successfully in production for a week.

PDLMobileApps avatar Sep 01 '20 16:09 PDLMobileApps

waitForBeforeload is necessary. I think it prevent duplicate event.

for fix problem you maybe want correct it instead of remove.

I have found same problem before and fixed by correct it when onPageFinished. Real problem is when load error it not reset waitForBeforeload.

Could you please check commit?

stionic avatar Sep 24 '20 04:09 stionic

waitForBeforeload is necessary. I think it prevent duplicate event.

for fix problem you maybe want correct it instead of remove.

I have found same problem before and fixed by correct it when onPageFinished. Real problem is when load error it not reset waitForBeforeload.

Could you please check commit?

We have been using the change in this PR in our app in the Google Play Store for almost two month (500k installs). We have no reports of issues with beforeLoad which is called a lot when the customer uses the app. So, if waitForBeforeload is really necessary, I would expect a completely different situation.

By the way, no one has been able to provide a good explanation on why it's needed. On the other hand, if you have in the code, beforeLoad only happens every other request, which is definitely wrong. That has been reported more than once by many people.

It would really nice to have an good explanation on why it's necessary. By looking at the code, I cannot really understand it.

PDLMobileApps avatar Oct 01 '20 19:10 PDLMobileApps

To follow up on this PR, I've found in testing that this PR is necessary for beforeload to function more than once. @stionic: The code for waitForBeforeload doesn't prevent duplicates of the beforeload event occurring and can be safely removed .

dtarnawsky avatar Sep 16 '21 21:09 dtarnawsky

This PR fixes the issues we found too!

ep-mark avatar Jul 11 '22 01:07 ep-mark

Thank you. This finally fixed this issue for me.

wunschradio avatar Feb 09 '23 17:02 wunschradio