Question

EDIT: Mozilla fixed the bug. This thread is dead.

EDIT: This is a Mozilla bug. See this thread: https://bugzilla.mozilla.org/show_bug.cgi?id=501853

I have a sprite I use for my images here: http://www.trailbehind.com/site_media/images/sprite.png

In FireFox 3.5, the sprite seems to get fetched every time I render an icon on my map, you can see the behavior in the Firebug Net Panel when you load this page and/or pan the map: http://www.trailbehind.com/node/1148091/

I had previously had similar problems to this in Internet Explorer, but I had eventually gotten this working in Safari 3/4, FF 2/3, and IE 6/7/8. Now, something is wrong in FF 3.5 :(

I tried to put this code in the of the document to prec-cache the image, but to no avail:

  var pre = new Image();
  pre.src = "/site_media/images/sprite.png"; 

Here's the code that later creates the map markers (and fetches the sprite image again). It might be GMaps related - it doesn't seem to fetch a sprite to draw each icon or otheer image on the left... just the map.

//returns an image-like GIcon based on a sprite  
function getGIconSprite(attr) {
  var myicon = new GIcon(G_DEFAULT_ICON);
  myicon.sprite = {image:"/site_media/images/sprite.png", top:0};
  myicon.iconSize = new GSize(16,16);
  myicon.iconAnchor = new GPoint(8,8);
  myicon.shadow = null;
  myicon.sprite.left = attr.offset*16;
  return myicon;
}
Was it helpful?

Solution

This is official FireFox 3.5 bug. Simple hack for it is to create two class for all snipped object: one common for all with background image, and the second one with background position. That's all kids!)

OTHER TIPS

There seems to be a problem with FireFox 3.5 loading images from the server and not using the cache properly. Google "firefox 3.5 not caching images" and you will notice a lot of people noticing this problem.

it is gmaps JS related. you should use a pointer (copy of variable) to the existing variable, such as:

defaulticon.sprite = {image:"/site_media/images/sprite.png", top:0};

myicon.sprite = defaulticon.sprite;
myicon2.sprite = defaulticon.sprite;
etc.

I see you use Lighttpd. You might want to use Module: mod_expire for your static files. Set them to expire after a month or even more. You can find more information about this on Yahoo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top