jquery.cookie
A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
Installation
Include script *after* the jQuery library (unless you are packaging scripts somehow else):
<script src="/path/to/jquery.cookie.js"></script>
Usage
Create session cookie:
$.cookie('the_cookie', 'the_value');
Create expiring cookie, 7 days from then:
$.cookie('the_cookie', 'the_value', { expires: 7 });
Create expiring cookie, valid across entire page:
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
Read cookie:
$.cookie('the_cookie'); // => 'the_value'
$.cookie('not_existing'); // => null
Delete cookie by passing null as value:
$.cookie('the_cookie', null);
Note when clearing cookies, you must pass the exact same options that were used to initially set the cookie.
Options
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 is a session cookie.
path: '/'
Default: path of page where the cookie was created.
Define the path where cookie is valid. <b>By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior).</b> If you want to make it available for instance across the entire page use <code>path: '/'</code>. If you want to delete a cookie with a particular path, you need to include that path in the call.
domain: 'example.com'
Default: domain of page where the cookie was created.
secure: true
Default: +false+. If true, the cookie transmission requires a secure protocol (https).
raw: true
Default: +false+.
By default the cookie is encoded/decoded when creating/reading, using +encodeURIComponent+/+decodeURIComponent+. Turn off by setting <code>raw: true</code>.
Changelog
Development
- Source hosted at {GitHub}[https://github.com/carhartl/jquery-cookie]
- Report issues, questions, feature requests on {GitHub Issues}[https://github.com/carhartl/jquery-cookie/issues]
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.
Authors
{Klaus Hartl}[https://github.com/carhartl]
分享到:
相关推荐
cookie 插件 API 对于使用jquery技术的开发者来说是必备的重要插件
jCookie-一个jQuery-Plugin,为与CRUD相关的cookie处理提供方便的api 例子 创建和更新: jQuery.jCookie('cookie','value'); 删除: jQuery.jCookie('cookie',null); 阅读: jQuery.jCookie('cookie'); ...
jQuery.Cookie (by Roy Goode) jQuery.Cycle (by François Guillot) jQuery.dataTables (by Armin Sander) jQuery.dynatree (by François de Campredon) jQuery.Flot (by Matt Burland) jQuery.form ...
对于初学者来说,登录页记住用户名和密码的功能是...在项目中加入jquery.js和jquery.cookie.js两个依赖文件,并加入对应的页面中如: [removed][removed] <script type=text/javascript src=${BasePath}/static/
里面包含 Jquery 1.4.2 的 jquery.cookie+ jquery-1.4.2+ jquery-1.4.2.min+ jquery-1.4.2-vsdoc+ jquery-1.4.2-vsdoc_en + jQuery1.4.2_API帮助文档简体中文版
script src =" jquery.cookie.js " /> < script src =" cookie-checkbox.js " /> 你可以在这里jquery.cookie插件: 用法 步骤 1. 将 data-checkbox-* data-api 设置为 checkbox 所有 cookie 复选框都...
Js.cookie.js 和 jQuery.cookie.js 0、Js.cookie.js js.cookie.js : 一个简单,轻量级的JavaScript API,用于处理cookie; 下载地址:https://github.com/js-cookie/js-cookie/releases 优点: 适用于所有浏览器;...
Storage.js v2.0 如果您已经使用Storage.js创建了一个或多个站点,或者知道一个或多个站点,则将其URL添加到官方的。... script src =" http://cdn.jsdelivr.net/cookiejs/0.1/cookie.min.js " > </
jQuery Cookie 将添加到jQuery名称空间,并提供jQ扩展方法以将cookie绑定为...jQuery名称空间中别名来自的整个cookie单例API。 例如, cookies.set()可作为$.cookies.set() 。 有关所有可用cookie方法及其文档的列表
1.jQuery.cookie帮助类 访问系统相关 1.C#计算机信息类ComputerInfo 2.Api_Win32_Mac类工具包 3.在c#程序中放音乐的帮助类 GDI+相关,图像相关 1.生成缩略图的类文件SmallImage C#基础类库 1.Chart图形 Assistant...
第 1 章 初识 Express .......................................................................................................................1 1.1 JavaScript 革命 .........................................
前后端分离,前端: Vue.js+jquery、后端: python+flask构建企业微信打卡项目,web...后端接入随机地址,范围0-100米,使用腾讯JavaScriptApi webserverAPIsdk 加入详情页展示 v1.0 使用flask框架替换node.js前端请求
许可.js 概述 Permit.js 使为网站和应用程序构建交互式、多状态原型变得容易。 ... jquery.cookie 插件 用法 请参阅 更改日志 v0.3 (3/4/2014) 更多重构 添加公共 API 方法 v0.2 (3/2/2014) 重构
1.jQuery.cookie帮助类 访问系统相关 1.C#计算机信息类ComputerInfo 实现了计算机的信息获取功能,计算机名,IP,硬盘信息,网卡信息,操作系统信息等 2.Api_Win32_Mac类工具包 一个Win32的Api包,实现了大部分的...
扩展库1.jquery2.W3C1.HTMLcanvastable2.CSS3.JS Web API1.DOM 操作2.BOM 操作3.事件绑定4.ajax5.扩展库4.HTTP5.存储1.cookie2.session3.token4.localstorage5.sessionStorage6.indexDB6.websocket三.开发环境1.git2...
│ │ jquery.cookie.js │ │ jquery.metadata.js │ │ jquery.min.js │ │ jquery.nicescroll.min.js │ │ jquery.validate.js │ │ jquery.validate.message_cn.js │ │ login.js │ │ md5.js │ │ ...
1、原生ajax请求方式: 1 var xhr = new XMLHttpRequest();...2、jquery的ajax的post方法请求: $.ajax({ type: "POST", url: "http://xxx.com/api/test", dataType: 'json', // 允许携带证书
1.jQuery.cookie帮助类 访问系统相关 1.C#计算机信息类ComputerInfo 实现了计算机的信息获取功能,计算机名,IP,硬盘信息,网卡信息,操作系统信息等 2.Api_Win32_Mac类工具包 一个Win32的Api包,实现了大部分的...