Favicon.ico not shown in IE8

Added by Michael Leitman 12 months ago

Hey there :)

I am trying since yesterday to get the favicon of my webapp shown in Internet Explorer 8... but it doesn't work :(
Before, i created my application as follows:

int main (int argc, char **argv)
{
    return WRun(argc, argv, &createApplication);
}

and playing a favicon.ico in the root directory of my application.
But this only works for Chrome, Opera and Safari, not for Firefox and IE.

No i try to use the same as in the wtHomepage example:

int main (int argc, char **argv)
{
    // from wt home example:
    try
    {
        WServer server(argv[0]);
        server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);

        server.addEntryPoint(Application, createApplication, "", "/icons/favicon.ico");

        if (server.start())
        {
            WServer::waitForShutdown();
            server.stop();
        }
    }
    catch (Wt::WServer::Exception& e)
    {
        std::cerr << e.what() << std::endl;
    }
    catch (std::exception &e)
    {
        std::cerr << "exception: " << e.what() << std::endl;
    }
}

and put the favicon in rootdirectory/icons
This works at least in all browsers... except IE8 xD

If is inspect the generated HTML, the code looks fine:

"<link rel="icon" type="image/vnd.microsoft.icon" href="/icons/favicon.ico">

but the Console output shows me (only in IE8) that the favicon is not found:

192.168.1.67 - - [2012-Jul-03 09:09:47.711386] "GET /favicon.ico HTTP/1.1" 404 85

so i tried to moved it back to the root directory, with the effect, the favicon is found, but not shown in IE:
192.168.1.67 - - [2012-Jul-03 09:11:30.710949] "GET /favicon.ico HTTP/1.1" 200 1186

So i tried to start the wtHomepage example and look how it work... and find out, this example also doesn't show an icon in my IE :-o

This sounds defenitely as an IE special behavior,
but my problem is,
this is the most common used browser of my further costumers for my application xD

Is there something i can do to get this working?
Unfortunately i am still on Windows XP and can't test this behavior on IE 9 or higher,
but as i said, we have to support down to IE8 in our application -.-

best regards
- the incredible Leitman


Replies (7)

RE: Favicon.ico not shown in IE8 - Added by Vincenzo Romano 12 months ago

I have a few hints for you.
1. What about testing it with a different browser?
2. Check the actual file format here.
3. What about your "docroot"? Is the favicon.ico file actually accessible with the proper path/file permissions?

RE: Favicon.ico not shown in IE8 - Added by Michael Leitman 12 months ago

Hey Vincenzo,

And thanks for you answer :)

@1:
doh!, yeah i missed that to mention in my post,
but the favicon works as it should be in all other browsers, that i testet on Windows XP:
  • Chrome 20.0.1132.47
  • Firefox 13.0.1
  • Opera 12 build 1467
  • Safari 5.1.7 (7534.57.2)

But only in IE (8.0.6001.18702) i don't see a favicon, neither in the adress bar, nor in the tab,
eventhough it is loaded, as seen in my previous post.

What i just figured out, that even Facebook.com doesn't show me a favicon in IE o.O (bing.com works fine xD)

@2:
I am trying to use a common 16x16px, .ico filetype with 8-bit color depth... what i think should be accepted ^^

@3:
due to my understanding, the favicon is accessible, because of the output and code 200.. or am i wrong with my assumption?

Thanks for the Link Vincenzo, i will read more of the accessibility shown in http://en.wikipedia.org/wiki/Favicon#Accessibility
where is mentioned that

<link rel="icon" 
 type="image/vnd.microsoft.icon" 
 href="http://example.com/image.ico" />

is not supported in IE! ... but the refering link is dead http://msdn.microsoft.com/en-us/library/ms534366.aspx xD

Another question (on which i will have to work after this "problem" is solved"):
is there a way to change the favicon during runtime?
For example, assume i want to change the favicon depending on the user, who is currently logged in...
How can i do this? Setting a new entry point seems very wrong to me o.O

best regard,
- the incredible Leitman

RE: Favicon.ico not shown in IE8 - Added by Vincenzo Romano 12 months ago

HTTP response code 200 means : successfully retrieved and sent off the socket.
So, yes, it seems to be an issue on you browser. Please double-check the actual file type of the .ico file, just in case!

Well, in theory you can have a different favicon for each and every page. I don't know precisely on how to manipulate the HTML header in order to accomplish such a thing. But it's doable.
Then, if what you need is a "animated favicon", then an animated GIF favicon would do. But again check whether your browser supports it.
For example, Google Chrome (as of v20) doesn't, while Mozilla Firefox does.

RE: Favicon.ico not shown in IE8 - Added by Michael Leitman 11 months ago

Thanks again for your answer, Vincenzo :)

Yeah, "in theory" i know that is possible to change the favicon dynamically (at least with pure js/html) ^^

But what i want is, depending on different states of my application (for example user is logged in -> green favicon, no user -> blue one, Admin user -> red favicon, ... ) which is all on the same page, i just have other e.g. session cookies.

So, my question is, is there a way to achive this in "a wt way" and if yes "how"?

... for the IE8 problem... i gave it up xD
If even Facebook don't get an correct favicon, why the f... should i? :p

best regards
- the incredible Leitman

RE: Favicon.ico not shown in IE8 - Added by Michael Leitman 11 months ago

Thanks again for your answer, Vincenzo :)

Yeah, "in theory" i know that is possible to change the favicon dynamically (at least with pure js/html) ^^

But what i want is, depending on different states of my application (for example user is logged in -> green favicon, no user -> blue one, Admin user -> red favicon, ... ) which is all on the same page, i just have other e.g. session cookies.

So, my question is, is there a way to achive this in "a wt way" and if yes "how"?

... for the IE8 problem... i gave it up xD
If even Facebook don't get an correct favicon, why the f... should i? :p

best regards
- the incredible Leitman

RE: Favicon.ico not shown in IE8 - Added by Vincenzo Romano 11 months ago

In theory (again!) you could define your own favicon in your pages directly into the <head>...</head> document section in a number of different ways .
Now, unless I've missesd something important, there's no way to manipulate the (generated) webpage header stuff from within Wt.
So, the answer seems to be "no way!"
Sorry!

RE: Favicon.ico not shown in IE8 - Added by Michael Leitman 11 months ago

The only way that i found to manipultate header stuff was using
addMetaHeader or addMetaLink as written in the documentation:
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WApplication.html#abb9103bc749dac6942649ea693dc9a3d

(with respect for the decribing comments:
A meta header can only be added in the following situations:

when a plain HTML session is used (including when the user agent is a bot), you can add meta headers at any time.
or, when progressive bootstrap is used, you can set meta headers for any type of session, from within the application constructor (which corresponds to the initial request).
but never for a Wt::WidgetSet mode application since then the application is hosted within a foreign HTML page.)

thanks for you help again :)
- the incredible Leitman

(1-7/7)