- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 jsp 页面每秒刷新一次。页面上有两张图片。一个重 13 KB,另一个重 4 KB。 Firefox 不会一次又一次地加载图像,但 Chrome 会一次又一次地加载这两个图像。而且看起来很糟糕!有什么方法可以阻止浏览器一次又一次请求相同的图像?
最佳答案
您应该设置适当的Expire
header 和Last-Modified
header 。来自 the maker of Chrome :
Recommendations
Set caching headers aggressively for all static resources. For all cacheable resources, we recommend the following settings: Set Expires to a minimum of one month, and preferably up to one year, in the future. (We prefer Expires over Cache-Control: max-age because it is is more widely supported.) Do not set it to more than one year in the future, as that violates the RFC guidelines. If you know exactly when a resource is going to change, setting a shorter expiration is okay. But if you think it "might change soon" but don't know when, you should set a long expiration and use URL fingerprinting (described below). Setting caching aggressively does not "pollute" browser caches: as far as we know, all browsers clear their caches according to a Least Recently Used algorithm; we are not aware of any browsers that wait until resources expire before purging them.
Set the Last-Modified date to the last time the resource was changed. If the Last-Modified date is sufficiently far enough in the past, chances are the browser won't refetch it.
如果您在 HTTPS 下提供服务,则需要在服务器上拥有正确签名的证书,否则 Chrome 不会缓存任何内容。
关于java - 有什么方法可以阻止浏览器每秒请求相同的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14051338/
我想要一个按钮,单击该按钮会在指定时间后刷新当前页面。 我目前有: setTimeout(function reload(){ location = '' },1000) Relo
我有一个场景,我需要每秒向服务器发送数据(非常少的字节)。这个细节很重要,所以我也需要对其进行加密。 深入研究后,我认为我们可以使用 HTTP 协议(protocol),但在这种情况下,HTTP he
我在即将进行的测试的学习指南中得到了这个问题。我不明白如何解决这个问题。今天是我的考试,我希望能得到一些帮助。 如果 CPU 每条指令发出一个内存请求并且计算机以 200 MIPS 运行,大约需要多少
我正在编写一个程序来确定每秒可以运行多少个 NOP,但我得到的数字似乎非常小。 int main() { struct timeval tvStart, tvDiff, tvEnd;
我想实现每秒 5-1 百万次远程函数调用。假设我们有一台开始计算的 Central 计算机,还有一台执行计算的 Worker 计算机。实际配置中会有很多Worker计算机。 假设我们的任务是计算一个[
下面的代码向最后一个 div 添加了一个类: $(".mydivs:last").addClass('added'); 这适用于页面加载,但 div 在动画中,因此顺序会改变。有没有办法让代码每秒运行
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwa
我刚刚在 HBase 中创建了一个表并用数据填充了它。从 7 个区域服务器看来,数据已写入区域服务器 6 和 7。 但我不明白为什么服务器 6 和 7 的每秒请求数为零? 最佳答案 读取请求计数 和写
我正在开发一个聊天应用程序,需要您的帮助。如果有人在线,我将信息存储在数据库中。现在我有一个功能,可以显示您的好友列表以及聊天伙伴是否在线。问题是:如果有人上网,我想经常检查。到目前为止,我有一个每秒
我正在编写一个快速而肮脏的脚本来检测服务器停机时间。我有一台服务器和两个远程客户端,它们每秒对服务器执行一次 ping 操作以查看它是否已启动。 如果您最多可以每分钟运行一次 cron,我该如何设置任
有什么方法可以让 Graphite 绘制图表请求吗? 当你从 nginx_status 检索 nginx 请求时,你正在向 Graphite 发送一个绝对值,所以我在想是否有任何方法可以获取每秒的速率
我正在构建一个 Android 应用程序,它将加速度计和陀螺仪数据记录到文本文件中。在大多数教程中,他们使用的方法涉及创建两个文本文件,并每秒打开和关闭它们 50 次。即: private stati
嘿,我目前在我的 mysql 上有超过 300+ qps。在相当繁重的 PHP 网站上大约有 12000 UIP 一天/没有 cron。我知道在没有看到该网站的情况下很难判断是否可以,但您是否认为这完
我希望每秒钟使用我的鼠标移动功能旋转矩形我做错了什么?我怎样才能做我的变换,以便高度和旋转每隔一个元素改变一次?我用 if ( i % 2 == 0){} 试了一下 function modifyRe
有没有办法配置具有恒定负载的性能测试用例(例如,每秒 3 个新请求,持续 1 分钟)? 其他负载测试库具有此功能来设置请求率(例如 Artillery.io、Vegeta)。 k6 有设置VUs 的方
(只是想提一下,这是我的第一个问题,如果我做错了什么,我深表歉意)。我正在制作一个解析 CSV 文件并将其保存为列表的 Python 程序。但是,该程序需要用户输入他们希望将数据发送到服务器的速度。我
如何使用 python 将毫秒转换为帧数?我知道视频的帧速率(每帧 25 秒) 2683480 2684448 最佳答案 我最终决定手动执行此操作,因为我仍然没有弄清楚 ffmpeg 函数等 25fp
我有一个动态表,它按从主要编号到次要编号的降序排列。我想用 jQuery 在前 2 行放置红色背景,在接下来的行放置橙色背景,在接下来的 2 行放置黄色背景,在接下来的 3 行放置绿色背景。 表结构:
构建 Rails 应用程序 (ruby 2.4.0p0/Rails 5.1.4) 并使用我的 Macbook air (MacOS High Sierra 10.13.2) 在本地进行测试,但我一直遇
这个问题已经有答案了: NSTimer not firing when runloop is blocked (2 个回答) 已关闭 9 年前。 我使用 NSTimer,它每秒触发一次并更新一个标签,
我是一名优秀的程序员,十分优秀!