• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: favicons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: favicons


  • Subject: Re: favicons
  • From: Nicko van Someren <email@hidden>
  • Date: Fri, 30 Apr 2004 12:14:39 +0100

On 30 Apr 2004, at 06:57, Jim Witte wrote:

The icon itself is stored in an root file called 'favicon.ico' or something like that - look around on the tutorial pages on creating them. As for downloading them into an NSImage or something - I have no idea - perhaps WebKit has a method for easily downloading one file and parsing the image?

The following python works for me (assuming u is set to the URL that you have in hand):

>>> v = NSURL.URLWithString_relativeToURL_("/favicon.ico", u)
>>> i = NSImage.alloc().initWithContentsOfURL_(v)

In Objective-C this would be:

// Assumes NSURL *u to be the URL for which you need the favicon
NSImage *iconImage = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString: "/favicon.ico" relativeToURL: u]];

As for whether you can convince WebKit to give up the icon out of its cache if it's already loaded, I'm not sure.

Nicko
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >favicons (From: Denise Eatherly <email@hidden>)
 >Re: favicons (From: Jim Witte <email@hidden>)

  • Prev by Date: Re: Setting resolution of images in NSTextView - [SOLVED?]
  • Next by Date: NSImage allocation issues
  • Previous by thread: Re: favicons
  • Next by thread: NSOutlineView with ImageAndTextCell
  • Index(es):
    • Date
    • Thread