gpt4 book ai didi

jquery - 阻止 Opera 在后退按钮上从缓存中获取页面或强制缓存 AJAX

转载 作者:行者123 更新时间:2023-12-01 01:52:22 26 4
gpt4 key购买 nike

我有两个可能的解决方案。

  1. 如何强制 Opera 在 jQuery 中缓存 .ajax 调用?
  2. 如果用户通过单击“后退”按钮到达页面,如何强制 Opera 浏览器重新加载页面?

测试场景:打开页面,导航任何链接,然后通过后退按钮返回页面。页面是从缓存中获取的。

我已经阅读了几篇文章(也在 StackOverflow 上),但没有一篇起作用:1) 缓存 HTTP header - 忽略2) 元标记 - 忽略3) 使用 js onunload 事件和标志变量的解决方案 - 不起作用

还有其他建议吗?

最佳答案

是POST还是GET?

类似问题:http://my.opera.com/community/forums/topic.dml?id=435111

Why Ajax request, using the GET method, cannot be cached in Opera? Please look at this small test:

http://www.karapuz.by/media/js/ajax-GET-caching-test.html

It seems that Opera (mine is 10.10), in contrast to IE, FF, GC, and Safari, is not caching the ajax response, even if it is explicitly told to do that. Any ideas?

答案:

It now seems that the problem is in the jQuery library.

I made another test http://www.karapuz.by/media/js/ajax-GET-caching-test2.html , it uses more low level XHR object, not the jQuery's "ajax" as it was in the first test. And now Opera is fine!

关于jquery - 阻止 Opera 在后退按钮上从缓存中获取页面或强制缓存 AJAX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6340200/

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