Reply to Re: Favicon

Your name:

Reply:


Posted by d43m0n AT shaw DOT ca on 09/21/06 22:50

J.O. Aho wrote:
> The Eclectic Electric wrote:
>
> > To be honest, it was someone else's idea to interrogate the accept header
> > and I'm not sure whether his or my interpretation of how HTTP works is
> > correct (probably his!). He was implying that the browser sends up
> > individual HTTP requests for each element of the page, which would mean it
> > should indeed be possible to catch whether or not it was possible to send a
> > gif for the favicon.
>
> If my mind don't fool me, even a system that don't gif would request the gif
> file if it's linked from the html and it's first locally at the client that
> you will know if the gif was displayed or not, the browser won't send a
> special "header" telling the web server what it's capable of doing.
>
>
> //Aho

Ok, it looks like I have to spill it out for you.

First, by default, Internet Explorer will request for a favicon.ico in
the root of the web directory, or atleast at the root of the url. For
instence, "http://google.ca/favicon.ico".

Now, HTML code will redirect the browser to where the favicon is,
either relitive or absolute location.

<LINK REL="SHORTCUT ICON"
HREF="protocol://domain.ext/directory/mypage.ico">

Now, if you wanted to know that, this was the wrong group to post your
question in. However, to take it the step further, you could make that
ico to php. As long as the return data is binary/base64, it will use it
for the image. Now we all should know that fread is binary safe, so we
have no worry about that.

[favicon.php]

<?php
$file = 'favicon.gif';
header('Content-type: image/gif');
header('Content-length: '.filesize($file));

$handle = fopen($file);
while (!feof($handle)) {
echo fread($handle, 1024);
}
fclose($handle);
?>

I can't test the code, but something like this, you may need to use a
buffer inorder to send the headers.

Even some if statments will be required to select which image to send,
and personally, I have never seen a browser support a gif as a favicon.

For those who don't know html, meta tags are tags intended to
"configure" your browser specifically to your site, and contain
information intended for storing information about your site for search
engines and bots.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация