-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two requests for the same image #151
Comments
There is something about the server response which denies image caching. If I change |
These are the request headers: Accept:image/webp,/;q=0.8 Response headers: Do you see any problems? |
Where did you take those? Response headers for the image you used in the JSFiddle above are:
Only thing I see about caching is the |
if i set "Cache-Control" flag in HTTP header i have no problem
|
In this fiddle I used an url from our server: http://jsfiddle.net/93nwP/ . There's nothing special about caching, still, there are two requests. |
You were right, it was caused by our server preventing the caching of images. Thanks for your help! |
What was the reason? |
The Cache-Control header was not set on the response. |
In chrome, for some reason, there are two requests fired for the lazy loaded images. I found that other developers have the same problem. One of them created this fiddle where you can examine the problem: http://jsfiddle.net/3VwRq/4/
I found that the two requests are coming from these lines:
$self.attr("src", original);
attr("src", $self.data(settings.data_attribute));
If I change the second line for example to attr("src", "");, the it works fine.
The problem is only present in chrome, Firefox and IE are fine.
The text was updated successfully, but these errors were encountered: