【发布时间】:2012-01-04 00:17:27
【问题描述】:
我正在使用 UIWebView 显示包含链接的 html 页面,其中一些链接指向本地文件 (file://...),而另一些则指向远程网站 (http://...) .
对于某些网站 shouldStartLoadWithRequest 被调用两次,例如,如果 html 包含:
<a href="http://www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121">
然后 shouldStartLoadWithRequest 被调用,请求为
"www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121"
然后它再次被调用,但这次重定向请求为
"http://zagat.mobi/"
发生这种情况时是否可以从 UIWebView 获得反馈?
【问题讨论】:
-
我正在调用 BOOL ret = [[UIApplication sharedApplication] openURL:.... 与请求 URL。但是即使页面成功加载,每次调用(原始和重定向)的 ret 总是 NO。那是一个错误吗? (如果 URL 没有被重定向,则返回 YES)。