# IMPORTANT!
This project was moved to https://github.com/js-cookie/js-cookie, check [the discussion](https://github.com/carhartl/jquery-cookie/issues/349).
New issues should be opened at https://github.com/js-cookie/js-cookie/issues
# jquery.cookie [![Build Status](https://travis-ci.org/carhartl/jquery-cookie.png?branch=master)](https://travis-ci.org/carhartl/jquery-cookie) [![Code Climate](https://codeclimate.com/github/carhartl/jquery-cookie.png)](https://codeclimate.com/github/carhartl/jquery-cookie)
A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
**If you're viewing this, you're reading the documentation for the old repository.
[View documentation for the latest backwards compatible release (1.5.1).](https://github.com/js-cookie/js-cookie/tree/v1.5.1)**
## Build Status Matrix
[![Selenium Test Status](https://saucelabs.com/browser-matrix/jquery-cookie.svg)](https://saucelabs.com/u/jquery-cookie)
## Installation
Include script *after* the jQuery library (unless you are packaging scripts somehow else):
```html
<script src="/path/to/jquery.cookie.js"></script>
```
**Do not include the script directly from GitHub (http://raw.github.com/...).** The file is being served as text/plain and as such being blocked
in Internet Explorer on Windows 7 for instance (because of the wrong MIME type). Bottom line: GitHub is not a CDN.
The plugin can also be loaded as AMD or CommonJS module.
## Usage
Create session cookie:
```javascript
$.cookie('name', 'value');
```
Create expiring cookie, 7 days from then:
```javascript
$.cookie('name', 'value', { expires: 7 });
```
Create expiring cookie, valid across entire site:
```javascript
$.cookie('name', 'value', { expires: 7, path: '/' });
```
Read cookie:
```javascript
$.cookie('name'); // => "value"
$.cookie('nothing'); // => undefined
```
Read all available cookies:
```javascript
$.cookie(); // => { "name": "value" }
```
Delete cookie:
```javascript
// Returns true when cookie was successfully deleted, otherwise false
$.removeCookie('name'); // => true
$.removeCookie('nothing'); // => false
// Need to use the same attributes (path, domain) as what the cookie was written with
$.cookie('name', 'value', { path: '/' });
// This won't work!
$.removeCookie('name'); // => false
// This will work!
$.removeCookie('name', { path: '/' }); // => true
```
*Note: when deleting a cookie, you must pass the exact same path, domain and secure options that were used to set the cookie, unless you're relying on the default options that is.*
## Configuration
### raw
By default the cookie value is encoded/decoded when writing/reading, using `encodeURIComponent`/`decodeURIComponent`. Bypass this by setting raw to true:
```javascript
$.cookie.raw = true;
```
### json
Turn on automatic storage of JSON objects passed as the cookie value. Assumes `JSON.stringify` and `JSON.parse`:
```javascript
$.cookie.json = true;
```
## Cookie Options
Cookie attributes can be set globally by setting properties of the `$.cookie.defaults` object or individually for each call to `$.cookie()` by passing a plain object to the options argument. Per-call options override the default options.
### expires
expires: 365
Define lifetime of the cookie. Value can be a `Number` which will be interpreted as days from time of creation or a `Date` object. If omitted, the cookie becomes a session cookie.
### path
path: '/'
Define the path where the cookie is valid. *By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior).* If you want to make it available for instance across the entire domain use `path: '/'`. Default: path of page where the cookie was created.
**Note regarding Internet Explorer:**
> Due to an obscure bug in the underlying WinINET InternetGetCookie implementation, IE’s document.cookie will not return a cookie if it was set with a path attribute containing a filename.
(From [Internet Explorer Cookie Internals (FAQ)](http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx))
This means one cannot set a path using `path: window.location.pathname` in case such pathname contains a filename like so: `/check.html` (or at least, such cookie cannot be read correctly).
### domain
domain: 'example.com'
Define the domain where the cookie is valid. Default: domain of page where the cookie was created.
### secure
secure: true
If true, the cookie transmission requires a secure protocol (https). Default: `false`.
## Converters
Provide a conversion function as optional last argument for reading, in order to change the cookie's value
to a different representation on the fly.
Example for parsing a value into a number:
```javascript
$.cookie('foo', '42');
$.cookie('foo', Number); // => 42
```
Dealing with cookies that have been encoded using `escape` (3rd party cookies):
```javascript
$.cookie.raw = true;
$.cookie('foo', unescape);
```
You can pass an arbitrary conversion function.
## Contributing
Check out the [Contributing Guidelines](CONTRIBUTING.md)
## Authors
[Klaus Hartl](https://github.com/carhartl)
没有合适的资源?快使用搜索试试~ 我知道了~
CMSimple v5.14.zip
共445个文件
gif:104个
js:85个
php:81个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 58 浏览量
2024-03-18
21:24:48
上传
评论
收藏 1.71MB ZIP 举报
温馨提示
CMSimple v5.14.zip
资源推荐
资源详情
资源评论
收起资源包目录
CMSimple v5.14.zip (445个子文件)
jqueryui_cmsimplecore.css 36KB
jqueryui.css 36KB
skin.min.css 30KB
skin.ie7.min.css 27KB
core.css 23KB
stylesheet.css 15KB
stylesheet.css 9KB
stylesheet.css 6KB
stylesheet.css 6KB
style.css 5KB
visualblocks.css 5KB
prism.css 2KB
stylesheet.css 2KB
content.min.css 2KB
content.inline.min.css 2KB
stylesheet.css 831B
stylesheet.css 823B
tinymce_sitetitle1.css 355B
tinymce_sitetitle2.css 331B
_split_h1only.css 215B
_editor.css 0B
tinymce.eot 12KB
tinymce-small.eot 9KB
bgheader.gif 59KB
d.gif 3KB
loader.gif 3KB
throbber.gif 2KB
animated-overlay.gif 2KB
animated-overlay.gif 2KB
paste_after.gif 1KB
help.gif 1KB
paste.gif 1KB
create_after.gif 1KB
copy.gif 1KB
create.gif 1019B
new.gif 1019B
collapse.gif 1018B
rename.gif 992B
delete.gif 989B
delete.gif 989B
help_icon.gif 976B
contentlink.gif 953B
top_white.gif 891B
newslink.gif 874B
menulink.gif 868B
tr.gif 868B
save.gif 648B
expand.gif 632B
_delete.gif 631B
cross.gif 631B
showpage.gif 596B
delete.gif 581B
pt-BR.gif 562B
cut.gif 539B
question.gif 530B
downarrow.gif 351B
downarrow.gif 351B
uparrow.gif 348B
uparrow.gif 348B
problem.gif 312B
smiley-wink.gif 311B
smiley-cool.gif 310B
smiley-laughing.gif 306B
smiley-smile.gif 305B
smiley-foot-in-mouth.gif 305B
smiley-surprised.gif 303B
smiley-frown.gif 302B
smiley-cry.gif 301B
smiley-innocent.gif 300B
smiley-embarassed.gif 300B
smiley-kiss.gif 299B
smiley-undecided.gif 298B
smiley-yell.gif 298B
smiley-tongue-out.gif 292B
smiley-sealed.gif 290B
smiley-money-mouth.gif 290B
cs.gif 205B
cs.gif 205B
en.gif 189B
en.gif 189B
sitemaplink.gif 171B
printlink.gif 168B
da.gif 159B
da.gif 159B
no.gif 156B
no.gif 156B
nl.gif 154B
nl.gif 154B
object.gif 152B
es.gif 152B
fr.gif 152B
es.gif 152B
fr.gif 152B
sk.gif 148B
sk.gif 148B
de.gif 147B
de.gif 147B
fi.gif 138B
fi.gif 138B
hu.gif 131B
共 445 条
- 1
- 2
- 3
- 4
- 5
资源评论
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 高分项目,基于STM32+NUCLEO板设计彩色LED照明灯,纯cubeMX开发,内含SmartLED代码、电路图文件
- 云开发寝适闹钟微信小程序源码
- 树莓派入门指南必备书籍
- FEM-1有限元分析方法的目的和概念-复杂函数的两种近似方法
- 高分项目,基于stm32+nucleo-L476开发的智能灯,内含操作说明、电路图、源码,单片机电子设计大赛案例源代码
- webGl编程指南书籍下载
- JavaFX和DLX算法实现的数独游戏.zip
- 681814099-60888757.lrc
- 高分项目,电赛一等奖作品,基于STM32F4主控开发的老人健康监测智能手表,内含APP源码、手表Watch源码
- d788d43f8794a4c2349450fe08f41bd5ac6e39ab.webp
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功