当前位置:网站首页>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 !!!!!
边栏推荐
- 高斯消元的应用
- Gauss elimination solves the inverse of matrix (Gauss)
- MFC handy notes
- The diagram of user login verification process is well written!
- Node memory overflow and V8 garbage collection mechanism
- Double authentication of server and client
- 一种分布式深度学习编程新范式:Global Tensor
- Write a script that can run in Bash / shell and PowerShell
- Basic knowledge of website design
- MQTT X CLI 正式发布:强大易用的 MQTT 5.0 命令行工具
猜你喜欢
服务器、客户端双认证(2)
Fuzzy PID control of motor speed
CSV data file settings of JMeter configuration components
电机转速模糊pid控制
【Datawhale】【机器学习】糖尿病遗传风险检测挑战赛
Interview shock 68: why does TCP need three handshakes?
Unstoppable, pure domestic PCs have been in place, and the monopoly of the U.S. software and hardware system has been officially broken
Registration module use case writing
Alibaba cloud technology expert haochendong: cloud observability - problem discovery and positioning practice
matlab simulink实现模糊pid对中央空调时延温度控制系统控制
随机推荐
Gauss elimination solves the inverse of matrix (Gauss)
QT handy notes (III) use qtcharts to draw a line chart in VS
Matlab Simulink realizes fuzzy PID control of time-delay temperature control system of central air conditioning
copyTo
OFDM Lecture 16 - OFDM
Login module use case writing
2019 ICPC Asia Yinchuan regional (water problem solution)
Fuzzy PID control of motor speed
Server and client dual authentication (2)
JS 一行代码 获取数组最大值与最小值
学习笔记之常用数组api 改变原数组和不改变原数组的有哪些?
网络流学习笔记
MFC handy notes
Redis sentinel mode setup under Windows
JS one line code to obtain the maximum and minimum values of the array
uni-app学习总结
Add DLL
开发转测试:从0开始的6年自动化之路...
MySQL的逻辑架构
The whole process of server environment configuration