Black Pearl
Black Pearl

Reputation: 93

UIWebView get favicons

How can I get favicons from websites in ios UIWebView, like it is possible in android. Maybe my question are idiotic, but I can't find anything.

Upvotes: 1

Views: 1663

Answers (1)

Vineet Singh
Vineet Singh

Reputation: 4019

You can get favicon of any website using its url string.Lets take an example in which we're trying to get favicon of google :

NSString *myURLString = @"http://www.google.com/s2/favicons?domain=www.stackoverflow.com";
NSURL *myURL=[NSURL URLWithString: myURLString];
NSData *myData=[NSData dataWithContentsOfURL:myURL];

UIImage *myImage=[[UIImage alloc] initWithData:myData];

This method of getting favicon worked nicely for me.

All the best.

Upvotes: 5

Related Questions