-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnNavigationStarted called multiple times after page load completes #129
Comments
Looking into this further, I realized that any content loaded on the page (ads, iframes, js, etc) would trigger the onNavigationStarted function, which made the event unusable in my case. Instead I used a hack to inject JS into the page after the content loads to trigger an event just before navigating away from the page (beforeunload & unload events). It seems to work really well in most cases where the web page allows for it. Perhaps a new event like onPageNavigationStarted could be added. In my constructor, I had to declare the local/global callback functions:
` Here is my code. Hoping this could be useful for anyone stuck on the same problem. `
` |
Hello,
I seem to be having a problem with OnNavigationStarted event in opening (external) website content. I'm using OnNavigationStarted to show the activity indicator, and then OnNavigationCompleted to disable the activity indicator.
Frow what I can tell, OnNavigationStarted fires and some time later OnNavigationCompleted / OnContentLoaded both fire. But then it seems other items on the web page that are subsequently loaded seem to be triggering OnNavigationStarted again, with no subsequent OnNavigationCompleted event. Some of these seem to be "about:blank" URLs, others look to be JS code such as Google Analytics, banner ads, and iFrames, all likely asyncronous loading.
The resulting behavior is that the loading indicator turns on and never turns off. When starting from an input URL, I have something to compare to (e.g. the domains). However, in dealing with link clicks, http redirects, etc the only place I can determine the URL is in the OnNavigationStarted event.
I've been looking at different variables, such as (bool) Navigating to see if there's a way of determining if it's an actual navigation or just content loading on the same page, but I can't seem to make any headway. I'm not sure if this is a bug, or if something is wrong with my code. Any recommendations?
Thanks,
David
`
`
The text was updated successfully, but these errors were encountered: