Chrome sometimes reloads image after jQuery .appendTo, recieves 304

我的未来我决定 提交于 2019-12-11 08:57:12

问题


I'm building a slider. There is a set of slides, which I'm using as a content source and this content is appended to a transition wrapper everytime the slide is changing. After the transition finishes, the transition wrapper is removed from DOM. When I add completely new content (image) to the slider and I open it in Chrome for the first time, this image is not, of course, in Chrome's cache. The problem shows when I append the transition wrapper (with this new image) into DOM. Chrome sometimes (and sometimes not) sends a request to get that image and recieves a 304 response. It makes this request even 3x for the same image. But it really happens only when the slider with the new images is loaded for the first time. After refresh, the Chrome gets those "new" images from its cache and the slider works perfectly. Other browsers are OK.

BTW: I also use imagesLoaded plugin, but image preloading doesn't seem to have any effect on this problem.

I know there are better approaches to create image slider - using images as background-image etc. But my content source => transition wrapper is the way I'm using to create responsive / not-only-image / CSS3 slider.

I'm going to release this plugin soon, so I would really like to solve this problem quickly.

来源:https://stackoverflow.com/questions/10086239/chrome-sometimes-reloads-image-after-jquery-appendto-recieves-304

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!