[OpenLayers-Users] prevent browser cache
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Tue Jan 23 14:27:48 EST 2007
Hi Tim,
actually, all the drawing is handled by openlayers, except where I put a
selection using SLD on a layer, there I call a mergeNewParams to apply
the SLD. But mostly I just add layers to the map object, and let
openlayers handle all of the drawing.
Also, in your example, I would need to do this for each map update (pan
action etc.) or not? Otherwise the ttt parameter will still have the
same values all the time and it will end up in cache anyway.
I might have misunderstood your solution though.
Best regards,
Bart
Tim Schaub schreef:
>> for dynamically changing data browser cache on images could
>> be an unwanted feature. Chameleon for instance always appends
>> a random parameter to the url to prevent the browser cache
>> from coming into play.
>>
>> Is there such a switch in OpenLayers, i.e. to keep urls
>> unique? If not, at which level (Map, Layer, WMS, Untiled?)
>> would it be appropriate to have such a switch?
>>
>
> This may not suit all, but I think this is best handled at the application
> level (i.e. not in the library). I assume that you have some function that
> is triggering the redraw of your layer. You could trigger the redraw with
> something like:
>
> myLayer.mergeNewParams({'TTT': OpenLayers.Util.createUniqueID('ttt')});
>
> Doing it this way (instead of in Untiled.js) gives you a bit more
> flexibility in determining when the image should or should not be cached.
>
> Does that work for you?
>
> Tim
>
>
>> For now I have changed getURL in Untiled.js to get the
>> behaviour I wanted:
>>
>> getURL: function(bounds) {
>> var tileSize = this.map.getSize();
>> tileSize.w = tileSize.w * this.ratio;
>> tileSize.h = tileSize.h * this.ratio;
>> return this.getFullRequestString( {'BBOX': bounds.toBBOX(),
>> 'WIDTH': tileSize.w,
>> 'HEIGHT':
>> tileSize.h,
>> 'TTT': OpenLayers.Util.createUniqueID('ttt')} );
>> },
>>
>> Hope to hear some discussion on this subject.
>>
>> Best regards,
>> Bart
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>
--
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl
More information about the Users
mailing list