Jump to content

Rotating Favicon.icon


Recommended Posts

Hope the topic will fit in this category.

It might be odd but I was thinking to make the favicon.icon in the address bar to change. So hopefully I made a couple of icons and put them in the folder and used the images rotator to rotate the images and left the rotator.php in the header of the index.html

Now the favicon rotates in the Firefox each time I restart the firefox and do not rotate in IE. Here is the question obviously: what should I do that each time everyone refreshes the page in Firefox can have a new favicon. The Answer might be very simple for some coder out there but I do not know how I should clear the cache.

Thanks for help

Tavakoli.ws/pblog

Edited by kingram
Link to post
Share on other sites

In the rotator.php code, add the lines shown in red below (these lines add headers that will prevent your image from being cached):

 

if ($img!=null) {

$imageInfo = pathinfo($img);

$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];

header ($contentType);

header ("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1

header ("Expires: Fri, 05 Jul 2002, 05:00:00 GMT"); // date in the past

readfile($img);

} else {

if ( function_exists('imagecreate') ) {

header ("Content-type: image/png");

header ("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1

header ("Expires: Fri, 05 Jul 2002, 05:00:00 GMT"); // date in the past

$im = @imagecreate (100, 100)

or die ("Cannot initialize new GD image stream");

$background_color = imagecolorallocate ($im, 255, 255, 255);

$text_color = imagecolorallocate ($im, 0,0,0);

imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);

imagepng ($im);

imagedestroy($im);

}

}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...