当前位置:网站首页>Solve the problem of storing cookies in IE7 & IE8
Solve the problem of storing cookies in IE7 & IE8
2022-07-26 09:46:00 【Dark cloud_ Go away】
solve IE7 & IE8 Storage cookie problem
I've been working on a project recently , You need a browser that is compatible with a lower version , Now it is still used xp Systematic IE7 !!!! When I heard the news, I was all bad .
One of these functions requires cookie Store and clear , Found in ie8 And then there is no effect . resolvent :
/** * Set up cookie * @param {String} key * @param {String} value * @param {Number} expires The unit is in seconds * @param {String} path route * @param {String} domain host * @param {Boolean} secure Security level */
function setCookie(key, value, expires, path, domain, secure) {
// key If it is invalid, do nothing
if (!key) {
return;
}
// all cookie Of key All lowercase
key = key.toLowerCase();
key = key + '=' + escape(value) + ";";
expires = expires ? ("expires=" + new Date(new Date().getTime() + expires * 1000).toGMTString()) + ";" : "";
path = !!path ? "path=" + path + ";" : "path=/;";
domain = domain ? ("domain=" + domain) + ";" : "";
secure = secure ? "secure=true;" : "";
document.cookie = [key, expires, path, domain, secure].join("");
}
// eliminate cookie
function clearCookie(name) {
var e = new Date();
e.setTime(e.getTime() - 1);
var b = getCookie(name);
document.cookie = name + "=" + name + ";path=/; domain=" + window.location.host + "; expires=" + e.toGMTString()
}
True and effective !!!!!
边栏推荐
- 服务器环境配置全过程
- 图解用户登录验证流程,写得太好了!
- Use of OpenCV class
- Process32first returns false, error x message 24
- Node memory overflow and V8 garbage collection mechanism
- Network flow learning notes
- The problem of accessing certsrv after configuring ADCs
- 网络流学习笔记
- 学习笔记之常用数组api 改变原数组和不改变原数组的有哪些?
- Azkaban【基础知识 01】核心概念+特点+Web界面+架构+Job类型(一篇即可入门Azkaban工作流调度系统)
猜你喜欢
电机转速模糊pid控制
Fuzzy PID control of motor speed
R language ggplot2 visualization: align the legend title to the middle of the legend box in ggplot2 (default left alignment, align legend title to middle of legend)
V-permission add permission
matlab中的AR模型短时预测交通流
SSG框架Gatsby访问数据库,并显示到页面上
[datawhale] [machine learning] Diabetes genetic risk detection challenge
Search module use case writing
Spolicy request case
[fluorescent character effect]
随机推荐
[fluorescent character effect]
Great reward for interview questions
V-for dynamically sets the SRC of img
QT handy notes (VI) -- update interface, screenshot, file dialog box
Mqtt x cli officially released: powerful and easy-to-use mqtt 5.0 command line tool
Table extraction for opencv table recognition (2)
Matlab Simulink realizes fuzzy PID control of time-delay temperature control system of central air conditioning
E. Two Small Strings
v-for动态设置img的src
挡不住了,纯国产PC已就位,美国的软硬件体系垄断正式被破
CSV data file settings of JMeter configuration components
C managed and unmanaged
spolicy请求案例
The whole process of server environment configuration
Sqoop【环境搭建 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
学习笔记之常用数组api 改变原数组和不改变原数组的有哪些?
Network flow learning notes
高斯消元的应用
解决IE7 & IE8 存储cookie问题
matlab simulink实现模糊pid对中央空调时延温度控制系统控制