
您链接的文章在这里不起作用,但是您可以使用图像上的查询字符串来中断缓存,如下所示:
$("#profilePicForm").ajaxForm(function() { alert("Photo updated"); $("#newPhotoForm").slideToggle(); $("#profilePic img").load(function() { $(this).hide(); $(this).fadeIn('slow'); }).attr('src', '/Content/UsrImg/Profiles/PhotoName.jpg?' + new Date().getTime());});这会迫使浏览器再次检查图像,因为时间戳是添加到查询字符串中的,因此每次都不同。这意味着浏览器不再能够信任缓存了,因为那是一个稍微不同的服务器请求…因此它将导致您想要的重新获取。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)