首页 > 解决方案 > 多次调用相同的异步脚本,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>以任何方式更改标签)

标签: javascriptgoogle-chrome

解决方案


推荐阅读