What is favicon.ico? Personalise your site's bookmark (ZT)

xiaoxiao2021-03-06  76

What is favicon.ico? Personalise your site's bookmark

LINK:

Http://www.thesitewizard.com/archive/favicon.shtmlby Christopher Heng,

THESITEWIZARD.COM

Some time back, I had an email from a visitor asking me how I managed to have thefreecountry.com's icon displayed next to my URL in his browser's location bar. In fact, had he checked carefully, he would also have noticed that the icon is Also Used in his "favorites" menu.

Internet Explorer ( "IE") 5.0 and above has a facility where, if someone bookmarks your website (ie puts it in their "Favorites" menu), it associates a particular icon with your website in the bookmark. It tries to obtain that icon by first requesting for "favicon.ico" from the directory of your web page. If it can not find such a file, it will try to obtain it from the root directory of your website, failing which, it will simply use a default icon for The Bookmark.

On the other hand, the favicon.ico file is available, the icon will also be displayed beside your website name in the "Favorites" menu, the location bar in IE, and if the user opens up the "Favorites" folder, it will Be the icon used for the link to your site.

Mozilla, and probably also the new versions of Netscape (which are based on Mozilla), also have the ability to use the favicon.ico file, except that Mozilla also accepts the file in other graphics formats, such as the PNG format. It displays The "Favicon.ico" in The Location Bar of the Browser (The Partest Version of Opera Also Loads The Favicon.ico File Into The Address Bar if Available.

Software Requirements

If you have an Windows icon editor (which you may already have if you have purchased a programming language development system for Windows), you're all set.All is not lost, however, if you do not have the above. Simply pop over to thefreecountry.com's Free Resource Editors and icon Editors page at http://www.thefreecountry.com/programming/resourceeditors.shtml and get yourself one. That page lists a few free icon editors and resource editors. Just choose any of the icon editors that strikes your fancy and download it. Alternatively, you can also download one of the other packages that contain a resource editor. Resource editors are tools that programmers use to create and edit Windows "resources" like icons, cursors (ie, mouse pointers ), Menus, Dialog Boxes, etc. for our purpose here, you will only NEED TO USE The Icon Editor Portion of Such Resource Editors.

How to create a "favicon.ico" file

Create an image 16X16 pixels in size. Yes, it is really small and you can not really draw much in it. You should also restrict yourself to the standard Windows 16 colours, although I suspect that 256 colours will work fine. If you like , you can also create a 32X32 pixel icon, which will be scaled to size for the Favorites menu and the location bar. you can even put both 16X16 and 32X32 pixel icons into the same icon file. Windows will use the former for its menus and the latter when the user opens up a folder that is set to display large icons. It's probably not really necessary to do this if you can not be bothered. Save the image as an ICO file (named "favicon.ico", of course .) Upload it to your website you do not need to upload one to every directory of your site if you do not want to waste space -.. simply put it in your root directory and IE will apparently locate it eventually you can also Upload It Into Your Images Directory, But You Will Need To Modify Your Web Pages if you do. See Later in this article for more information on this.help! My Web Host Doesn't Allow Ico Files!

If your hosting company does not allow files with the .ICO extension to be uploaded, you might try to work around it by uploading it (in binary mode) with some other extension (like GIF). Once it's on your site, rename it using Your FTP Program to the Correct Extension.

Helping The Browser Locate The Favicon.ico File

If you have placed your favicon.ico file in a location other than the current web directory (relative to your web page) or the root directory, you have to help your visitors' browser locate the favicon file by specifying it with a tag like the Following in the section of Your Web Page.

You Should Replace "/favicon.ico" in The Above Example with the actual location of your favicon.ico file, for example, "/images/favicon.ico" ife "i" i "i" i "i i" d d "/ images /" Directory.

This step is optional if you have put your "favicon.ico" file in the standard locations, ie, in the same directory as the web page or in the root directory of your website. Otherwise you will need to modify all your existing web pages To Take Advantage of The "Favicon.ico" facility.

How Many People Are Bookmarking My Website?

This "favicon.ico" used to have an interesting side-effect. The side-effect applied whether or not you bothered to put a special "favicon.ico" on your site. You used to be able to find out the number of IE . 5 users who bookmarked your site by simply counting the requests for "favicon.ico" in your web server logs From that number, you can estimate the total number of people who bookmark your site by applying this formula: number of IE 5 bookmarks divided By The Fraction of Your Visitors Using IE 5.

For Example, IF Two-Thirds of Your Visitors Use IE 5 , And You Get 100 Requests for the icon, Simply Divide 100 by Two-thirds to get 150. This Was by no means an account measure - it Did NOT Take Into Account numerous factors: but at least it was able to give you a hint of how useful people find your site.However, this side effect is no longer relevant today Mozilla, Netscape and Opera load the favicon.ico to display in your visitors' location. Bar WHETHER THEY PUT Your Site In Their Favorites (or Bookmarks) or Not. Apparently The Mac OS X Browser, Safari, Also Loads The Favicon.ico File WHENEVER IT VISITS A Site (IT Uses It in The History Menu). I've NOT Checked The Latest Version of IE SO I'M NOT SURE IE IEES The Same Too. I Merely Mention This "Side-Effect" SO That You Won't deceive yourself when you see the larpe of "favicon.ico" requests In Your Web Logs: It Doesn't Tell You That Those Your Visitors Bookmarked Your Site Anymore.

Miscellaneous Matters

If you are testing your favicon file in Internet Explorer, and find that you're seeing an old version of your favicon.ico file, you probably need to empty your browser's cache (and possible restart the browser). Internet Explorer caches the favicon. ico file in the "Temporary Internet Files" folder, so if you do not empty the cache, you'll probably continue to see your old version and not the new version that you've created. incidentally, this also means that if your Visitors Empty Their Cache, Their Copy of The Favicon.ico File That Associated with The Bookmark of Your Site Will Also Be Lost.

Conclusion

转载请注明原文地址:https://www.9cbs.com/read-108569.html

New Post(0)