You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

zebra_cookie

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zebra_cookie

An extremely small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies

1.0.7
Source
npm
Version published
Weekly downloads
5
-82.76%
Maintainers
1
Weekly downloads
 
Created
Source

####An extremely small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies

##Features

  • easily write, read and delete cookies
  • very simple and intuitive syntax, blending perfectly with jQuery
  • extremely small: with around 500 bytes when minified is probably the smallest and most optimized jQuery plugin for handling cookies

##Requirements

Zebra_Cookie requires jQuery 1.0+

##How to use

Zebra_Cookie is available as a Bower package. To install it use:

bower install zebra_cookie

Zebra_Cookie is also available as a npm package. To install it use:

npm install zebra_cookie

Load the latest version of jQuery from a CDN and provide a fallback to a local source, like:

<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>window.jQuery || document.write('<script src="path/to/jquery-1.12.0.js"><\/script>')</script>

Load the Zebra_Cookie plugin

<script type="text/javascript" src="path/to/zebra_cookie.js"></script>

Usage

// inside the DOM-ready function
// a "cookie" object will be available in jQuery’s namespace
// the object exposes 3 methods that you can use to write, read and delete cookies
$(document).ready(function() {

    // create a session cookie (expires when the browser closes)
    $.cookie.write('cookie_name', 'cookie_value');

    // create a cookie that expires in 1 day
    $.cookie.write('cookie_name', 'cookie_value', 24 * 60 * 60);

    // read a cookie’s value
    // following the examples above, this should return "cookie_value"
    $.cookie.read('cookie_name');

    // the "read" method returns null if the cookie doesn’t exist
    $.cookie.read('non_existing_cookie_name');

    // delete the cookie
    $.cookie.destroy('cookie_name');

});

Detailed description of available methods can be found on the project's homepage

Keywords

jquery-plugin

FAQs

Package last updated on 22 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts