javascript - 多次调用相同的异步脚本,Chrome 只下载一次
问题描述
我有一个页面,其中有一个脚本在一个页面中被多次调用,例如:
<script async type="text/javascript" src="https://example.com/script?id=abc"></script>
<script async type="text/javascript" src="https://example.com/script?id=abc"></script>
<script async type="text/javascript" src="https://example.com/script?id=abc"></script>
<script async type="text/javascript" src="https://example.com/script?id=abc"></script>
由于每个请求的脚本输出都会发生变化,因此每次都需要下载。在 Firefox 上它按预期工作,但 Chrome 只下载一次或两次,即使它有标题
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
我能怎么做?(我无法<script>
以任何方式更改标签)
解决方案
推荐阅读
- reactjs - 如何在两个反应组件之间传递状态?
- r - 如何使用 ggplot2 以所需的比例绘制?
- amazon-web-services - 我如何更正 AWS Glue Crawler/Data Catalog 将 CSV 中的所有字段推断为字符串,而这些字段显然不是?
- upload - 我们如何使用 C# 在 Azure 中更新和上传内容到 Blob
- laravel - 无法将数据持久化到数据库?(拉拉维尔)
- memory - repr(C) 是预处理器指令吗?
- vue.js - 如何正确配置 vuelidate?
- html - 尝试将鼠标悬停在第一个和最后一个子菜单上时消失
- java - 计算两个坐标之间的距离 SQL + Criteria Builder
- jquery - 在 Angular 中动态更新 jQuery datepicker 属性