<audio> 和 Mozilla Firefox 缓存问题
<audio> and Mozilla Firefox Cache issue
我有下一个html代码
<script type="text/javascript">
playSound = function(soundUrl) {
var sound = new Audio(soundUrl);
sound.autobuffer = false;
sound.play();
}
</script>
<input type="button" onclick="playSound('audioCaptcha')" value="Play"/>
audioCaptcha 是我的音频存储路径,return 是唯一的音频片段。它与 Google Chrome 和 IE 完美配合,但不适用于 Mozilla Firefox。由于缓存的奇怪工作,我每次都得到旧的音频片段。
Header: "Cache-Control", "private,no-cache,no-store"
作为解决方法,我可以使用带有随机参数的 soundUrl,例如audioCaptcha?12345,但我希望有更合适的解决方案。
网络统计:
在下一次尝试中没有任何请求出现,Firefox 将使用前一个音频片段。但是如果用户愿意等待 ~20 秒,那么一切都很好。看起来尽管 Cache-Control headers Firefox 存储了它。我想关闭这种可能性。
我将此问题提交给 Firefox 错误跟踪器并得到确认。
您可以在此处跟踪状态:https://bugzilla.mozilla.org/show_bug.cgi?id=1129121
我有下一个html代码
<script type="text/javascript">
playSound = function(soundUrl) {
var sound = new Audio(soundUrl);
sound.autobuffer = false;
sound.play();
}
</script>
<input type="button" onclick="playSound('audioCaptcha')" value="Play"/>
audioCaptcha 是我的音频存储路径,return 是唯一的音频片段。它与 Google Chrome 和 IE 完美配合,但不适用于 Mozilla Firefox。由于缓存的奇怪工作,我每次都得到旧的音频片段。 Header: "Cache-Control", "private,no-cache,no-store"
作为解决方法,我可以使用带有随机参数的 soundUrl,例如audioCaptcha?12345,但我希望有更合适的解决方案。
网络统计:
在下一次尝试中没有任何请求出现,Firefox 将使用前一个音频片段。但是如果用户愿意等待 ~20 秒,那么一切都很好。看起来尽管 Cache-Control headers Firefox 存储了它。我想关闭这种可能性。
我将此问题提交给 Firefox 错误跟踪器并得到确认。 您可以在此处跟踪状态:https://bugzilla.mozilla.org/show_bug.cgi?id=1129121