UIWebView: webViewDidStartLoad/webViewDidFinishLoad delegate methods not called when loading certain URLs

Posted by Dia on Stack Overflow See other posts from Stack Overflow or by Dia
Published on 2010-12-03T08:20:53Z Indexed on 2011/01/09 22:53 UTC
Read the original article Hit count: 290

I have basic web browser implemented using a UIWebView. I've noticed that for some pages, none of the UIWebViewDelegate methods are called.

An example page in which this happens is: http://www.youtube.com/user/google. Here are the steps to reproduce the issue (make sure you insert NSLog calls in your controller's UIWebViewDelegate methods):

  1. Load the above youtube URL into the UIWebView [notice that here, the UIWebViewDelegate methods do get called when the page loads]
  2. Touch the "Uploads" category on the page
  3. Touch any video in that category [issue: notice that a new page is loaded, but none of the UIWebView delegates are called]

I know that this is not an issue of UIWebView's delegate not being set properly, since the delegate methods do get invoked when loading other links (e.g. if you try clicking on a link that takes you outside of youtube, you'll notice the delegate methods getting called).

My gut feeling initially was that it might be because the page is loaded using AJAX, which may not invoke the delegate method. But then when I checked Safari, it did not exhibit this problem, so it must be something on my side.

I've also noticed that Three20's TTWebController has the exact same issue as I'm having.

But the problem that arises from this issue is that without the delegate methods called, I'm unable to update the UI to enable/disable the back and forward browsing buttons when new requests are loaded.

And idea why this is happening or how can I work around it to update the UI when a new request is made?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiwebview