When IE does not load images

Recently the need for a custom photo gallery surfaced in one of my GWT pet projects. While such an endeavour seems endless from an artistic point of view, the mechanics behind it – at least for my humble needs – were rather simple:

  1. the gallery widget will be given a list of image IDs
  2. for each ID an image element will be created, assigned the image URL and added to the DOM

Surprisingly, this will lead IE 7 to never load any but the first image while the rest will remain in the loading state. A quick test shows that this happens only through DOM manipulation by adding new image elements to the DOM. I found two simple workarounds:

  1. add each image in a DeferredCommand of its own.
  2. display a fixed number of images and reuse them. Thus, instead of removing and creating image nodes, leave them on the page and reassign a new URL to them (src attribute)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.