Are the images dynamic (user can upload them), or static (known at compile
time)?

If the images are from a fixed set of images that are available at compile
time, you should consider using
ImageBundle<http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign>.
It would take care of most of your concerns. In addition, it can bundle
multiple images in a single file, saving further http round trips.

If you are images are dynamic, or if you are not using GWT 2.0, you will
have to set appropriate HTTP Cache headers when the image is served.
Essentially, your server tells the browser "This image is not going to
change for the next few years, so you can cache it till then without
bothering to ask me if it has changed".

A typical strategy is assigning every image a unique name based on a MD5
hash of its contents. You then set a far in the future expiry date on that
image, so that browser doesn't go back to the server to see if it has
changed. If the image changes, you will generate a totally different file
name, and hence the browser will download it again.

--Sri


2009/11/11 dicko <[email protected]>

> Hi there
>
> I've setup a basic GWT app that's essentially an image gallery.  The
> gallery works by updating an Image widget with widget.setURL('url')
> either by clicking a forward or back button.  To reduce bandwidth, the
> images are only loaded as they're requested (ie. by clicking the
> forward button).
>
> However, images are being forcibly reloaded when a use clicks the back
> button rather than retrieving a cached image stored by the client's
> browser.  Obviously, in an attempt to speed the page load and reduce
> bandwidth, it would be preferable to use a cached image rather than
> reloading the same image every time it's requested.
>
> Has anybody else had this problem and is there any way around this?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=.


Reply via email to