SetCookie: function (name, value)//設定Cookie值
{
var expdate = new Date();
var argv = arguments;
var argc = arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if (expires != null) expdate.setTime(expdate.getTime() + (expires * 1000));
document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
+ ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain))
+ ((secure == true) ? "; secure" : "");
},
DelCookie: function (name)//刪除Cookie
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = GetCookie(name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
},
GetCookie: function (cookieName) {
var cookieString = document.cookie;
var start = cookieString.indexOf(cookieName + '=');
if (start == -1) return null; // 加上等號的原因是避免在某些 Cookie 的值裡有與cookieName一樣的字串
start += cookieName.length + 1;
var end = cookieString.indexOf(';', start);
if (end == -1) return unescape(cookieString.substring(start));
return unescape(cookieString.substring(start, end));
}
js cookie
相關文章
- js-cookie.js的使用JSCookie
- cookie外掛-jquery.cookie.js介紹CookiejQueryJS
- js清除所有的cookieJSCookie
- JS筆記-007-JS Window-cookieJS筆記Cookie
- JS 基礎篇(十) cookie封裝JSCookie封裝
- js cookie 頁面倒數計時JSCookie
- npm包:js-cookie的簡單使用NPMJSCookie
- 終於理解了 Next.js 中的 CookieJSCookie
- js逆向) 某音cookie中的__ac_signatureJSCookie
- Next.js-Cookie鑑權+續期+退出登入JSCookie
- 新增cookie、刪除cookie、清除cookieCookie
- 簡單介紹Vue中使用js-cookie詳情VueJSCookie
- Node.js+Express 開發之Cookie、Session 使用詳解Node.jsExpressCookieSession
- Java操作Cookie之新增CookieJavaCookie
- JS逆向實戰11——某金屬集團動態cookie加密JSCookie加密
- 通過釘釘網頁上的js學習xss打cookie網頁JSCookie
- CookieCookie
- 利用js裡的Dom和Date,自定義cookie的前端設定方法JSCookie前端
- 如何獲取Cookie並使用Cookie侵入Cookie
- 如何設定cookie和刪除cookieCookie
- go cookieGoCookie
- Cookie 起源Cookie
- javascript cookieJavaScriptCookie
- Cookie原理Cookie
- cookie sessionCookieSession
- 新增cookieCookie
- cookie & sessionCookieSession
- Python Cookie HTTP獲取cookie並處理PythonCookieHTTP
- Python Flask,cookie,設定、獲取、刪除cookiePythonFlaskCookie
- cookie跨域共享 cookie二級域名共享 前後端分離專案共享cookieCookie跨域後端
- cookie&sessionCookieSession
- Cookie和SessionCookieSession
- session和cookieSessionCookie
- Cookie Store APICookieAPI
- Cookie相關Cookie
- cookie 簡介Cookie
- JavaScript 建立CookieJavaScriptCookie
- Postman同步cookiePostmanCookie
- Cookie簡介Cookie