开发者

webView:shouldStartLoadWithRequest:navigationType: not always triggered

As can be seen in the screencast below, I'm having a devil of a time getting webView:shouldStartLoadWithRequest:navigationType: to be called consistently.

In the scr开发者_JAVA技巧eencast below, you'll see a UIWebview with three size selectors. When clicking on any of these three, webView:shouldStartLoadWithRequest:navigationType: should be getting triggered. Unfortunately, that doesn't always seem to be happening. It doesn't event seem to happen consistently.

http://screencast.com/t/ww6uwP1Je

So what's causing this? Is there an error method of UIWebViewDelegate that I could hook into to pick up some of what's going on internally?


It seems like you aren't setting the UIWebViewDelegate properly. I noticed in the screencast that it worked once you clicked the 'L' (presumedly "large") button. Is that method setting the delegate? If not, please paste a code snippet that shows the issue.


Since the other two buttons generate calls to the delegate we know your web view delegate is properly assigned.

The simplest explanation for the failure is that S button is not configured in HTML properly and does not generate a actual request for the web view to load. With no request, the delegate methods are never called in the first place.


Ok, turns out I didn't provide anyone enough information for anyone to answer the question - I even removed the relevant parts from the webview gist given above. Sorry!

Here's the full template:

https://gist.github.com/521d17e0377133725d9a

Turns out there was an onclick handler on the li surounding the link (see the gist above - "#sizes_slider li"). Removing that onclick handler did the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜