Our iOS app has a Web View that is rendering pages from file: URLs. When the user touches an <A>
element to switch pages, about 20% of the time, it gets stuck as follows:
- User taps
<A>
link - We get WebView.shouldStartLoadWithRequest callback
- We get WebView.webViewDidStartLoad callback
- nothing happens after this
The screen still shows the original page with the link on it. We can break the logjam in two ways:
- Rotate the device
- Tap the screen
At that point, the page will immediately finish loading.
We used the recipe from here:
Javascript console.log() in an iOS UIWebView
to allow us some insight into the page load. We put the javascript-side stuff right in the first script file we load on the page, and it doesn't print its message until after we do the rotate-or-tap workaround.
So it appears that it is getting stuck somewhere between starting to load the page, and starting to evaluate the stuff on the page.
We have tried a number of work-around, none of which helped:
- Setting location.href instead of using the tag
- Setting location.href from javascript timeout
- In the didStartLoad callback, created a thread that called setNeedDisplay on the webView over and over
Any idea what we might be doing wrong?