无法通过AJAX在IE中更改会话变量 [英] Unable to change session variable through AJAX in IE

查看:99
本文介绍了无法通过AJAX在IE中更改会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一些奇怪的行为与IE浏览器尝试使用AJAX在服务器上更改会话变量时。它工作正常在FF,Chrome浏览器,Safari浏览器,以及所有其他我测试过,但不是在IE浏览器。

I'm getting some weird behavior from IE when trying to change a session variable on the server using AJAX. It works fine in FF, Chrome, Safari, and all the others I've tested but not in IE.

我保持匿名用户会话变量的变量(整数)的列表,以便我能够保持自己的数据,当/如果他们在网站上注册。我使用jQuery和AJAX调用一个Django的功能更新会话变量。

I'm maintaining a list of variables (integers) in a session variable for anonymous users so I can keep their data when/if they register on the site. I'm using jQuery and AJAX to call a Django function that updates the session variable.

在IE浏览器的古怪行为是在刷新(再次命中服务器)会议仍然没有更新。只有当我清除浏览器缓存或查看当前饼干做了会话更新。

The odd behavior in IE is that on refresh (hitting the server again) the session is still not updated. Only when I clear the browser cache or view current cookies does the session update.

任何想法?

推荐答案

我有同样的问题,但与主塔,我所做的就是创建一个中间件设置以下配置在我的响应头。

I had the same problem, but with Pylons, what I did was create a middleware that set the following configuration in my response headers.

headers["Cache-Control"] = "no-cache"
headers["Pragma"] = "no-cache"
headers["Expires"] = -

这里是什么这样做的说明。

Here is a description on what this does.

这篇关于无法通过AJAX在IE中更改会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆