1
votes

I'm using a UIWebView to display html pages which contain links, some of the links are to local files (file://...) and some are to remote web site (http://... ).

For some sites shouldStartLoadWithRequest gets called twice, for example if the html contains:

<a href="http://www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121">

Then shouldStartLoadWithRequest gets called as expected with a request of

"www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121"

But then it gets called again but this time with a redirection request of

"http://zagat.mobi/"

Is it possible to get feedback from the UIWebView when this is happening?

1
I'm calling BOOL ret = [[UIApplication sharedApplication] openURL:.... with the request URL. But ret is always NO for every call (original and redirect) even though the page successfully loads. Is that a bug? (It returns YES if the URL doesn't get redirected).Gruntcakes

1 Answers

1
votes

This happens when a site redirects you to their mobile version. I just tested this in the Safari iPhone App with the link you posted and it indeed redirects to Zagat's mobile site. Some websites are smarter than others as to where you get redirected. You can force the page to load the non-mobile version by not allowing redirects.