how to detect redirects of url occurs while loading UIWebView on iphone?
ios, iphone, objective-c, redirect, uiwebview
Solution
Yes you can do this. Implement
– webView:shouldStartLoadWithRequest:navigationType:
This delegate . This method gets called whenever your webview is about to make a request. So now when someone clicks a button or hyperlink on your webpage, you will get a call to this method. After you catch this call, you can choose to do whatever you want with it. Like redirect the link through your own servers, or log a request to your server about user activity or in your case bring up comments page or change nav bar etc.
Maybe from the `request` you can figure out if the HTTP response code is 3xx redirection then you can do what you want...
Problem
Is there any way to detect url redirects occurs while loading a UIWebView in iphone. when I load www.example.com url, it redirects to some other url. I need to get those redirecting urls and where is actually we handles redirection.