All Projects → jaywcjlove → Cookie.js

jaywcjlove / Cookie.js

🍪 A simple, lightweight JavaScript API for handling browser cookies , it is easy to pick up and use, has a reasonable footprint(~2kb, gzipped: 0.95kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks. https://npm.im/cookiejs

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Cookie.js

Nookies
🍪 A set of cookie helpers for Next.js
Stars: ✭ 1,035 (+523.49%)
Mutual labels:  cookie
Auth Module
auth.nuxtjs.org
Stars: ✭ 1,624 (+878.31%)
Mutual labels:  cookie
Android Cookie Store
Android InMemory and persistent Cookie Store for HttpURLConnection and OkHttp, with extensions to easily sync cookies in Android WebViews.
Stars: ✭ 144 (-13.25%)
Mutual labels:  cookie
Redux Cookies Middleware
redux-cookies-middleware is a Redux middleware which syncs a subset of your Redux store state with cookies.
Stars: ✭ 75 (-54.82%)
Mutual labels:  cookie
Wyycg Autocheckin
✨白嫖小助手提醒您:今天你白嫖网易云游戏了吗?快来跟我一起白嫖网易云游戏,成为云游戏长期在线用户吧!
Stars: ✭ 94 (-43.37%)
Mutual labels:  cookie
Ngx Cookieconsent
Cookie 🍪 Consent module for Angular.
Stars: ✭ 120 (-27.71%)
Mutual labels:  cookie
Php Educational Administration
大学微信查教务成绩 数据抓取 数据分析 微信查成绩 验证码识别 redis缓存
Stars: ✭ 38 (-77.11%)
Mutual labels:  cookie
Vue Warehouse
A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js.
Stars: ✭ 161 (-3.01%)
Mutual labels:  cookie
Web Analytics
监测分析、异常监测、广告验证、访客唯一标识
Stars: ✭ 97 (-41.57%)
Mutual labels:  cookie
Electrode Csrf Jwt
Stateless Cross-Site Request Forgery (CSRF) protection with JWT
Stars: ✭ 127 (-23.49%)
Mutual labels:  cookie
Localslackirc
IRC gateway for slack, running on localhost for one user
Stars: ✭ 84 (-49.4%)
Mutual labels:  cookie
Review reverse
👋2019年末总结下今年做过的逆向,整理代码,复习思路。🙏拼夕夕Web端anti_content参数逆向分析👺 WEB淘宝sign逆向分析;😺努比亚Cookie生成逆向分析;🙌百度指数data加密逆向分析 👣今日头条WEB端_signature、as、cp参数逆向分析🎶知乎登录formdata加密逆向分析 🤡KNN猫眼字体反爬👅Boss直聘Cookie加密字段__zp_stoken__逆向分析
Stars: ✭ 1,302 (+684.34%)
Mutual labels:  cookie
Cookiescanner
Cookie Scanner for GDPR compliance
Stars: ✭ 126 (-24.1%)
Mutual labels:  cookie
Agentweb
AgentWeb is a powerful library based on Android WebView.
Stars: ✭ 8,375 (+4945.18%)
Mutual labels:  cookie
Rack Policy
Rack middleware for the EU ePrivacy Directive compliance in Ruby Web Apps
Stars: ✭ 149 (-10.24%)
Mutual labels:  cookie
Cookie Autodelete
Firefox and Chrome WebExtension that deletes cookies and other browsing site data as soon as the tab closes, domain changes, browser restarts, or a combination of those events.
Stars: ✭ 1,015 (+511.45%)
Mutual labels:  cookie
Angular2 Cookie
Implementation of Angular 1.x $cookies service to Angular 2
Stars: ✭ 112 (-32.53%)
Mutual labels:  cookie
Sessions
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
Stars: ✭ 2,148 (+1193.98%)
Mutual labels:  cookie
Curlsharp
CurlSharp - .Net binding and object-oriented wrapper for libcurl.
Stars: ✭ 153 (-7.83%)
Mutual labels:  cookie
Cookie Parser
Parse HTTP request cookies
Stars: ✭ 1,683 (+913.86%)
Mutual labels:  cookie

JavaScript Cookie

Build Status Coverage Status cookie.js

🍪 A simple, lightweight JavaScript API for handling browser cookies, it is easy to pick up and use, has a reasonable footprint (~2kb) (gzipped: 0.84kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks.

Features:

🚀 Has no dependencies
🌱 Works in all browsers
🍁 Support TypeScript, including d.ts definition
🔥 Heavily tested
📦 Supports AMD/CommonJS
💥 cookie.min.js 2.01kb(gzipped: 0.84kb)

Usage

Installed via npm. You will need Node.js installed on your system.

$ npm install cookiejs --save
import cookie from 'cookiejs';

cookie("test", "tank", 1)

Or manually download and link cookiejs in your HTML, It can also be downloaded via UNPKG or jsDelivr CDN:

<script src="https://unpkg.com/cookiejs/dist/cookie.min.js"></script>
<script type="text/javascript">
  cookie("test", "tank", 1);
</script>

Basic Usage

cookie(key, value, num)

key cookie name
value cookie value
num expires time

cookie('test', 'tank', 1)    // Create a cookie that expires 1 days from now
cookie('test')               // Create a cookie, valid across the entire site
cookie('test', null)         // Delete cookie `test`
cookie()                     // Get all cookie

cookie.set('test', 'tank', 1) // ====cookie('test', 'tank', 1)
cookie.get('test')            // ====cookie('test')
cookie.remove('test')         // ====cookie('test',null)
cookie.remove('test3', 'test4') // Delete cookie `test3` and `test4`

cookie.clear()                // Clean all cookie
cookie.all()                  // Get all cookie

Set Cookie

cookie.set(name, value, options)
The same effect cookie(name, value, options)

Set the value of the cookie in batches

cookie.set({
  name1: 'value1',
  name2: 'value2'
});

Create cookie that expires 30 days from now

cookie('test', 'tank', 30);  // Create a cookie that expires 30 days from now

cookie({ 'test':'123', 'test2':'456' }, { // 批量设置
  'expires': 30,
  'path': '/',
  'domain':''
});

Create cookie that expires 30 days from now,and set cookie attributes

cookie('test', '123', { 'expires': 30, 'path': '/', 'domain':'' });

Cookie Attributes

individually for each call to cookie.set(...) by passing a plain object in the last argument. Per-call attributes override the default attributes.

Examples:

cookie('name', 'value', { 'expires': 30, 'path': '/', 'domain':'' });
cookie.get('name')
cookie.remove('name')

expires

Define when the cookie will be removed. Value can be a Number which will be interpreted as days from time of creation or a Date instance. If omitted, the cookie becomes a session cookie.

cookie('name', 'value', { 'expires': 30 });

path

Default: /

A String indicating the path where the cookie is visible.

cookie.set('name', 'value', { path: '' });
cookie.get('name'); // => 'value'

domain

Default: Cookie is visible only to the domain or subdomain of the page where the cookie was created, except for Internet Explorer (see: Note regarding Internet Explorer default behavior).
⚠️If you omit the domain attribute, it will be visible for a subdomain in IE.

A String indicating a valid domain where the cookie should be visible. The cookie will also be visible to all subdomains.

Examples:

cookie.set('name', 'value', { domain: 'subdomain.website.com' });
cookie.get('name'); // => undefined (need to read at 'subdomain.website.com')

secure

Default: No secure protocol requirement.

Either true or false, indicating if the cookie transmission requires a secure protocol (https).

Examples:

cookie.set('name', 'value', { secure: true });
cookie.get('name'); // => 'value'
cookie.remove('name');

License

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].