I have found a solution. Apparently, if you include the following bit
of code in your <head>, then it will prevent strings of 304s when you
instantiate a sprite multiple times in Javascript:
<head>
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
</head>
Here's the bit of javascript that instantiates the sprite DOM object:
function makeSprite(filename) {
var div = dec('div');
div.className = 'sprite ' + filename;
return div;
}
And here's the relevant CSS classes:
div.sprite {
background-image: url(/site_media/images/sprite.png);
background-repeat: no-repeat;
}
div.red-x { #red-x.png is the filename
background-position: -453px -16px;
height: 12px;
margin: 0;
width: 12px;
padding: 0;
}
On Jun 5, 7:02 pm, andrewljohnson <[email protected]> wrote:
> Thanks for everyone's help with this. I have a related question now,
> though it's not about GMaps persay. In my javascript, I often create
> instances of a sprite DOM object:
>
> function makeSprite(filename) {
> var div = dec('div');
> div.className = 'sprite ' + filename;
> return div;
>
> }
>
> Each time I do this, IE6 pings the server and gets back a 304. Is
> there any way to avoid the 304 and make IE use the cached image?
> Dozens of round trips are killing me.
>
> Andrew
>
> On Jun 4, 10:57 pm, Mike Williams <[email protected]> wrote:
>
> > The way I preload images is to write this in global context, so that it
> > executes while the page loads.
>
> > var pre = new Image();
> > pre.src = "/site_media/images/sprite.png";
>
> > Then use <body onload> to call the code that creates the markers, so
> > that that doesn't happen until after the page load is complete.
>
> > --
> > Mike Williamshttp://econym.org.uk/gmap
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---