ressio / lazy-load-xt

Lazy load XT is a jQuery plugin for images, videos and other media
http://ress.io/lazy-load-xt-jquery/
MIT License
1.36k stars 245 forks source link

Safari Mac Issue #80

Open AlexNodex opened 8 years ago

AlexNodex commented 8 years ago

When loading on Safari (OSX El-capitan [not sure if this helps]) and the image has both a "src" and "data-src" attribute then the "load" never gets fired- if I remove the "src" attribute and just leave "data-src" then all is well.

This happens on my retina macbook pro but ONLY on a screen with a DPR of 1 - it doens't effect retina loading.

A little debugging has shown that it grabs the source fine, just something never completes!

On every other browser using the same scenario then it's fine - seems to be scoped to Safari.

AlexNodex commented 8 years ago

Further investigation reveals that it's most likely an issue inside the Safari code that perhaps refuses to load an image if the source change is no different because if I change the el.src line to el.src = src+'?'+new Date().getTime(); then it works as expected, this is obvisouly really bad for caching as I don't want to be forcing a new download each time nor do I want to be appending query strings to sources.

AlexNodex commented 8 years ago

I have worked out a fix that shoul save the cache round trip.

Around line 216 if(src) { el.src=src; } Needs changing to if(src) { el.src=''; el.src=src; } Hope this helps someone else

markaba commented 7 years ago

I can confirm the bug/Problem in OS X El Capitansafari 9.1 also the solution works fine, thank you!