apache / apache/cordova-plugin-inappbrowser
"loadstop" Never Fires and Therefore executeScript Never Fires
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
On some webpages, walmart.ca for example, the loadstop event for the inappbrowser is never fired. I assume that since loadstop fires for most websites that walmart.ca (and others) have some kind of code that is still running in the background so the page never really stops loading, and therefore the executeScript event never fires.
If I manually call .show on the inappbrowser object, for example after 10 seconds as loadstop never was called, the inappbrowser will show and the page appears to have loaded fine. but the executeScript event never fired as loadstop was never called. I have tried calling executeScript just before I call .show with a timer to bypass the loadstop event and the executeScript code doesn't actually get called.
It appears that only executeScript will work after loadstop event has been fired.
But, what is the solution if loadstop is never called as the page keeps loading something in the background, but it is fine to show to the user as the webpage has essentially completed loading and is fully functional.
`
inAppBrowserRef.addEventListener("loadstop", loadStopCallBack);
function loadStopCallBack() {
inAppBrowserRef.executeScript( .... // this works if the page actually stops loading
}
// a delayed function that is called after 30sec
function timeWait() {
inAppBrowserRef.executeScript( .... // the page is loaded just fine, but "stop" event isn't fired due to some code on the page so executeScript has never fired
}
`
### What is expected to happen?
executeScript is called
if i call .show and the page is completely workable, then i shouldn't have to wait for loadstop event to load my injected code.
### What does actually happen?
injected code is never called
## Information
see code example
### Command or Code
see code example
### Environment, Platform, Device
android, newest version on everything
### Version information
newest
## Checklist
- [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
Contributor guide
Research direction
Start by reproducing the Android InAppBrowser flow using the reported loadstop, show, and executeScript calls against walmart.ca or another page that keeps loading. Trace why executeScript only runs after loadstop, then compare the behavior when show is called first; done means injected code runs on a usable page without depending on loadstop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100