Hi all,
we've been discussing weird shortcut icons behaviour on IRC for a while. Most of the trouble seems to be really just browser related, since I eventually got to see my icon on Opera and still cannot have it on Firefox 3. Yet... to make it show on Opera I had to move the code until it read:
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" >
so my AIDASite>>addLinkToFavicon now reads:
addLinkToFavicon: aFaviconImageOrUrl
"favicon (favorites icon). So far only in .ico format!"
| url |
url := aFaviconImageOrUrl isString
ifTrue: [aFaviconImageOrUrl]
ifFalse: [self site urlResolver halfUrlFor: aFaviconImageOrUrl].
self addHeader: 'link' value: 'rel="shortcut icon" type="image/x-icon" href="', url, '" '
not sure whether saying "shortcut icon" instead of just "icon" would be THAT critical, yet it works like this and it didn't before.
The whole investigation started upon deleting the demo site to start my own site. The icon vanished at that point. In the process I stumbled upon what really looks like a bug to me, and I corrected it. Nicolas suggested that I should execute
(AIDASite named: 'mySiteName') initFavicon
to fix the problem, yet I was getting weird results upon inspecting the outcome. It looked as if nothing happened. In the end I came to realize that initFaviconcould not be executed as long as an existing favico was in cache. So I modified AIDASite>>initFavicon as follows.
initFavicon
we've been discussing weird shortcut icons behaviour on IRC for a while. Most of the trouble seems to be really just browser related, since I eventually got to see my icon on Opera and still cannot have it on Firefox 3. Yet... to make it show on Opera I had to move the code until it read:
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" >
so my AIDASite>>addLinkToFavicon now reads:
addLinkToFavicon: aFaviconImageOrUrl
"favicon (favorites icon). So far only in .ico format!"
| url |
url := aFaviconImageOrUrl isString
ifTrue: [aFaviconImageOrUrl]
ifFalse: [self site urlResolver halfUrlFor: aFaviconImageOrUrl].
self addHeader: 'link' value: 'rel="shortcut icon" type="image/x-icon" href="', url, '" '
not sure whether saying "shortcut icon" instead of just "icon" would be THAT critical, yet it works like this and it didn't before.
The whole investigation started upon deleting the demo site to start my own site. The icon vanished at that point. In the process I stumbled upon what really looks like a bug to me, and I corrected it. Nicolas suggested that I should execute
(AIDASite named: 'mySiteName') initFavicon
to fix the problem, yet I was getting weird results upon inspecting the outcome. It looked as if nothing happened. In the end I came to realize that initFaviconcould not be executed as long as an existing favico was in cache. So I modified AIDASite>>initFavicon as follows.
initFavicon
"/favicon.ico, a small icon shown in browser near url address"
"(AIDASite named: 'biart') initFavicon."
| icon |
icon := WebMethodImage initCache;
fromMethod: #favicon on: self style contentType: 'image/x-icon' site: self.
self urlResolver defaultURL: '/favicon.ico' forObject: icon.
###############################
The #initCache is needed (at least so it seems) because on WebMethodImage:
fromMethod: aSymbol on: anObject contentType: aString site: anAIDASite
"cached one only preservers its url, but method is still called everytime image is shown!"
| cached |
cached := self imageForObject: anObject andMethod: aSymbol.
^cached notNil
ifTrue: [cached]
ifFalse: [super new
object: anObject;
method: aSymbol;
contentType: aString;
site: anAIDASite;
addToCache]
#################################
I suppose this should be corrected in the official image, too (unless there is something else that clears the cache).
Let me know
Berto
#################################
I suppose this should be corrected in the official image, too (unless there is something else that clears the cache).
Let me know
Berto