gpt4 book ai didi

javascript - Google 托管库不必要地使用缓存断路器

转载 作者:行者123 更新时间:2023-11-29 18:17:33 25 4
gpt4 key购买 nike

我在我们的仪表板上使用以下代码来不断刷新它而不会闪烁 How can I refresh a page with jQuery?:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
setTimeout(function() {
$.ajax({
url: "",
context: document.body,
success: function(s,x){
$(this).html(s);
}
});
}, 4000);
</script>

但是,由于某些缓存破坏者,这也会导致 javascript 每次都重新加载。

enter image description here

Google 正在发送以下 header :

enter image description here

为了不让我自己和我的客户被 Google 屏蔽(那时可能还不如成为门诺教徒),有没有一种方法可以在不引起这些额外请求的情况下使用 Google CDN?

最佳答案

警告未经测试:

$.ajax({
url: "",
dataType: "text", //dont parse the html you're going to do it manually
success: function(html) {
var $newDoc = $.parseHTML(html, document, false); //false to prevent scripts from being parsed.
$('body').replaceWith(newDoc.find("body")); //only replace body
}
});

更好的解决方案是为您的 body 制作模板。

关于javascript - Google 托管库不必要地使用缓存断路器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21761931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com