IE下COOKIE失效的一种特殊情况
2012-11-28 11:00
274 查看
setcookie ("name",
"value",
0, "/",
".example.com");
使用以上代码设置cookie后,在非IE(chrome、firefox等)下访问 test_1.example.com 均可正常获取;使用IE访问则获取不到该cookie。
访问 test.example.com 任何浏览器均可正常获取。
本来以为是setcookie参数问题,后来以为是两套代码不同问题,发现都不是。
最后发现是域名问题:域名中不能含有“_”(下划线)。。。
------------------------------我是分割线-------------------------------
RFC 952 有明文规定
A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from the
alphabet (A-Z), digits (0-9), minus sign (-), and period (.) .
Note that periods are only allowed when they serve to delimit components of "domain style names". (See RFC-921, "Domain Name System Implementation Schedule", for background). No blank or space characters are permitted as part of a name. No distinction is made
between upper and lower case. The first character must be an alpha character. The last character must not be a minus sign or period. A host which serves as a GATEWAY should have "-GATEWAY" or "-GW" as part of its name. Hosts which do not serve as Internet
gateways should not use "-GATEWAY" and "-GW" as part of their names. A host which is a TAC should have "-TAC" as the last part of its host name, if it is a DoD host. Single character names or nicknames are not allowed.
虽然很多网站,甚至是某些知名网站的一些二级域名仍有采用这种不规范命名,但大家在平时使用中还是最好应尽量避免使用带有下划线的域名。
"value",
0, "/",
".example.com");
使用以上代码设置cookie后,在非IE(chrome、firefox等)下访问 test_1.example.com 均可正常获取;使用IE访问则获取不到该cookie。
访问 test.example.com 任何浏览器均可正常获取。
本来以为是setcookie参数问题,后来以为是两套代码不同问题,发现都不是。
最后发现是域名问题:域名中不能含有“_”(下划线)。。。
------------------------------我是分割线-------------------------------
RFC 952 有明文规定
A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from the
alphabet (A-Z), digits (0-9), minus sign (-), and period (.) .
Note that periods are only allowed when they serve to delimit components of "domain style names". (See RFC-921, "Domain Name System Implementation Schedule", for background). No blank or space characters are permitted as part of a name. No distinction is made
between upper and lower case. The first character must be an alpha character. The last character must not be a minus sign or period. A host which serves as a GATEWAY should have "-GATEWAY" or "-GW" as part of its name. Hosts which do not serve as Internet
gateways should not use "-GATEWAY" and "-GW" as part of their names. A host which is a TAC should have "-TAC" as the last part of its host name, if it is a DoD host. Single character names or nicknames are not allowed.
虽然很多网站,甚至是某些知名网站的一些二级域名仍有采用这种不规范命名,但大家在平时使用中还是最好应尽量避免使用带有下划线的域名。
相关文章推荐
- IE下cookie的version区别与特殊字符支持情况
- IE下iframe跨域session和cookie失效问题的解决方案
- .net下导致Session失效的一种情况:js教本中使用window.open和window.showModalDialog时需要注意
- .net下导致Session失效的一种情况:js教本中使用window.open和window.showModalDialog时需要注意
- 使用ntpdate中遇到的一种特殊情况
- java设置cookie的maxage在ie失效
- 关于 UIWebView reload 失效的 一种情况
- .net下导致Session失效的一种情况:js教本中使用window.open和window.showModalDialog时需要注意
- 大家应该都用过SVN,多个小组开发时,分小组提交代码,可是有特殊情况的,小组要穿插提交增量文件,该怎么做呢?SVN补丁是一种能导出变更增量的方法。
- IE下iframe跨域session和cookie失效问题的解决方案
- 一种特殊情况
- .net下导致Session失效的一种情况:js教本中使用window.open和window.showModalDialog时需要注意
- spring依赖注入失效或不成功的一种情况和解决办法
- UESTC 1582 奇迹的魔法啊,再度出现! 二进制树(字典树的一种特殊情况)
- Session失效之 IE iframe cookie问题(p3p)
- Thymeleaf的th:href标签失效的一种情况分析及解决方案
- poj 1719 Shooting Contest 二分图匹配的一种特殊情况
- 物化视图的容易失效的一种情况解决
- 关于IE6下line-height失效的一种诡异情况
- Cookie失效的一种可能