Check "icon" as well as "shortcut icon" when finding the favicon link in a web page. (See Macdrifter.com, for instance.)

This commit is contained in:
Brent Simmons 2017-11-25 13:01:20 -08:00
parent 55166e0979
commit 0b5f470654
1 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@ static NSString *relValue(NSDictionary *d);
static BOOL typeIsFeedType(NSString *type); static BOOL typeIsFeedType(NSString *type);
static NSString *kShortcutIconRelValue = @"shortcut icon"; static NSString *kShortcutIconRelValue = @"shortcut icon";
static NSString *kIconRelValue = @"icon";
static NSString *kHrefKey = @"href"; static NSString *kHrefKey = @"href";
static NSString *kSrcKey = @"src"; static NSString *kSrcKey = @"src";
static NSString *kAppleTouchIconValue = @"apple-touch-icon"; static NSString *kAppleTouchIconValue = @"apple-touch-icon";
@ -58,7 +59,10 @@ static NSString *kTypeKey = @"type";
_baseURLString = urlString; _baseURLString = urlString;
_dictionaries = dictionaries; _dictionaries = dictionaries;
_faviconLink = [self resolvedLinkFromFirstDictionaryWithMatchingRel:kShortcutIconRelValue]; _faviconLink = [self resolvedLinkFromFirstDictionaryWithMatchingRel:kShortcutIconRelValue];
if (_faviconLink == nil) {
_faviconLink = [self resolvedLinkFromFirstDictionaryWithMatchingRel:kIconRelValue];
}
NSArray *appleTouchIconDictionaries = [self appleTouchIconDictionaries]; NSArray *appleTouchIconDictionaries = [self appleTouchIconDictionaries];
_appleTouchIcons = objectsOfClassWithDictionaries([RSHTMLMetadataAppleTouchIcon class], appleTouchIconDictionaries, urlString); _appleTouchIcons = objectsOfClassWithDictionaries([RSHTMLMetadataAppleTouchIcon class], appleTouchIconDictionaries, urlString);