Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prevent images being re-downloaded #2

Closed
necolas opened this Issue · 9 comments

6 participants

Nicolas Gallagher Scott Jehl Gordon Brander Peter Droogmans Martin Keckeis Sergi Meseguer
Nicolas Gallagher

When I resize the viewport, smaller images are downloaded. And when I resize to wider viewports, the larger images appear to be re-downloaded. So I can end up with dozens of requests in my dev tools when there are only 5 or so images referenced in the HTML.

Scott Jehl
Owner
Scott Jehl
Owner

A native implementation would probably do the best job of ensuring that re-requests don't happen on resize, regardless of cache settings, though I'd think the average image caching configuration would probably ensure resize re-requests are hitting cache as it is.

For this though, I wonder if keeping already-used image objects on-hand would avoid the issue entirely...

Gordon Brander

On a related note, we should probably create the <img> element if it doesn't exist already. Assuming <picture> became a reality, it seems like leaving the fallback to JavaScript could be a reasonable compromise at a future date. That would also solve the multiple download issue.

Peter Droogmans

Using the div version all images are downloaded once, but it appears that the src is replaced while resizing even if it isn't needed, resulting in a lot of aborted connections.

Martin Keckeis

@scottjehl i also recognized this behaviour when scalling the browser windows down.

Maybe you can just make and if clause to check following:

  • would be newly requested image be larger then the current? -> load it
  • would the new loaded image be smaller -> DONT load it...just keep displaying the larger?

best regards

Sergi Meseguer

that would go against the art direction benefit of this technique

Martin Keckeis

hmm....but target is better performance -> so this could improve it.

When i move my browser window from fullscreen to a smaller size -> every image gets reloaded....

Maybe this could be just an configuration option?

Scott Jehl
Owner
Scott Jehl
Owner

Since we're aiming to match native picture support at this point, I'm going to close this out. Per the spec at this point, the native element will act as a controller for an img tag, and I'm not sure how to avoid those requests to cache without toggling the image's src. Happy to reopen if there's a workaround to explore here. Thanks!

Scott Jehl scottjehl closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.