惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cisco Blogs
NISL@THU
NISL@THU
G
GRAHAM CLULEY
T
Threatpost
I
Intezer
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
Security Latest
Security Latest
P
Palo Alto Networks Blog
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
AI
AI
Help Net Security
Help Net Security
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
月光博客
月光博客
The GitHub Blog
The GitHub Blog
aimingoo的专栏
aimingoo的专栏
C
CERT Recently Published Vulnerability Notes
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Scott Helme
Scott Helme
A
About on SuperTechFans
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
V
V2EX
MongoDB | Blog
MongoDB | Blog
AWS News Blog
AWS News Blog
Google DeepMind News
Google DeepMind News
Google Online Security Blog
Google Online Security Blog
O
OpenAI News
Y
Y Combinator Blog
S
Securelist
GbyAI
GbyAI
D
Docker
SecWiki News
SecWiki News
The Hacker News
The Hacker News
有赞技术团队
有赞技术团队
T
Tenable Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
P
Privacy International News Feed
S
Security Affairs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - iQingHan

C#中二进制和流之间的各种相互转换 underscore-1.8.3-analysis.js 经典JS 12 extremely useful hacks for JavaScript IIS字体文件添加MIME映射 js类型判断的方法 基于html5 canvas 的客户端异步上传图片的插件,支持客户端压缩图片尺寸 Google Chrome 默认非安全端口列表 js判断类型的方法 博客园样式排版自定义 easyloader.js源代码分析 jQuery插件的开发 jQuery 1.9 移除了 $.browser 的替代方法 Pretty Gmail GreasemonkeyScript jQuery之移除链接小插件 ASP.NET中关于验证控件和自定义弹出确认窗口的冲突问题 JQuery获取浏览器窗口的可视区域高度和宽度,滚动条高度 jQuery的选择器 园子里使用的jQuery.json
JQuery操作cookies
iQingHan · 2013-06-19 · via 博客园 - iQingHan
 1 jQuery.cookie = function(name, value, options) {   
 2     if (typeof value != 'undefined') { // name and value given, set cookie  
 3         options = options || {};  
 4         if (value === null) {  
 5             value = '';  
 6             options.expires = -1;  
 7         }  
 8         var expires = '';  
 9         if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {  
10             var date;  
11             if (typeof options.expires == 'number') {  
12                 date = new Date();  
13                 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));  
14             } else {  
15                 date = options.expires;  
16             }  
17             expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE  
18         }  
19         // CAUTION: Needed to parenthesize options.path and options.domain  
20         // in the following expressions, otherwise they evaluate to undefined  
21         // in the packed version for some reason...  
22         var path = options.path ? '; path=' + (options.path) : '';  
23         var domain = options.domain ? '; domain=' + (options.domain) : '';  
24         var secure = options.secure ? '; secure' : '';    
25         document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');  
26     } else { // only name given, get cookie  
27         var cookieValue = null;  
28         if (document.cookie && document.cookie != '') {  
29             var cookies = document.cookie.split(';');  
30             for (var i = 0; i < cookies.length; i++) {  
31                 var cookie = jQuery.trim(cookies[i]);  
32                 // Does this cookie string begin with the name we want?  
33                 if (cookie.substring(0, name.length + 1) == (name + '=')) {  
34                     cookieValue = decodeURIComponent(cookie.substring(name.length + 1));  
35                     break;  
36                 }  
37             }  
38         }  
39         return cookieValue;  
40     }  
41 };