Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling URL Redirections in UIWebView

I have a UIWebView in my app that is used to show webpages of links clicked within my app.

Some of the links are URL-Shortened links, such as tinyURL or bit.ly. These URLs redirect after the initial URL load.

My problem is that some of the links in my app are URL-Shortened links to resources that are not webpages - such as videos or other media.

I can use the webView:shouldStartLoadWithRequest:navigationType: to intercept the URL and decide what to do with it - only it is only called on the initial load, and not after the redirect.

What can I do to intercept the URL that the bit.ly link is pointing at?

like image 556
Jasarien Avatar asked Apr 07 '09 10:04

Jasarien


1 Answers

It seems my overzealous mind didn't take the time to actually inspect the flow of the URL loading with UIWebView. The webView:shouldStartLoadWithRequest:navigationType: does capture redirects. Sorry for wasting anyone's time ;)

like image 85
Jasarien Avatar answered Sep 20 '22 15:09

Jasarien