Local Data: Store multiple values in single cookies

Recommend this page to a friend!
     
  Info   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 221 All time: 222 This week: 5Up
Version License JavaScript version Categories
local-data 1.0Artistic License1.0Browser, jQuery
Description 

Author

This object can store multiple values in a single cookie.

It can set, get and delete different key values that can be encode to be stored in a single browser cookie.

The original values of the keys are preserved as they are encoded using JSON before storing in the cookies.

Picture of Pavel Kukov
Name: Pavel Kukov <contact>
Classes: 1 package by
Country: Bulgaria Bulgaria
Age: ???
All time rank: 1131 in Bulgaria Bulgaria
Week rank: 6 Up1 in Bulgaria Bulgaria Equal

Details

Sample usage for localdata.js ============= * Store - $.localdata("name", "value"); value can be integer, string, object, array $.localdata("name", [1,2,3,4,5]); $.localdata("name", {name: "John Dow", email: "john@company.com"}); * Read - $.localdata("name"); * Delete One Item By Key - $.localdata.remove("name"); or $.localdata("name",null,{expires:-1}); * Delete entire cookie - $.localdata.clear(); * Count Stored Items - $.localdata.count(); * Force Reload - $.localdata.reload(); * Get/Set cookie configuration - $.localdata.config() and $.localdata.config({expires: 'in days', path: 'your new path', domain: 'domain', 'secure': true or false}) defaults are expires: 365, path: '/', domain: '', 'secure': '' * Get/Set cookie prefix - $.localdata.prefix() and $.localdata.prefix("new_prefix_") default is "localdata_cookie_" PHP: Sample usage for localdata.php ============= * Include - include('localdata.php'); * Create Object - $localdata = localdata::get(); * Store - $localdata("name", "value"); or $localdata->name = "value"; value can be integer, string, object, array $localdata("name", array(1,2,3,4,5)); $localdata("name", array("name" => "John Dow", "email" => "john@company.com")); * Read - $localdata("name"); or $localdata->name * Delete One Item By Key - $localdata->remove("name"); * Delete entire cookie - $localdata->clear(); * Count Stored Items - $localdata->count(); * Get/Set cookie configuration - $localdata->config() and $localdata->config(Array('expires' => 'in days', 'path' => 'your new path', 'domain' => 'domain', 'secure' => true or false}) defaults are 'expires' => 365, 'path' => '/', 'domain' => NULL, 'secure' => NULL * Get/Set cookie prefix - $localdata->prefix() and $localdata->prefix("new_prefix_") default is "localdata_cookie_"

  Files folder image Files (6)  
File Role Description
Files folder imagejs (2 files)
Accessible without login Plain text file index.html Doc. index.html
Accessible without login Plain text file index.php Doc. index.php
Accessible without login Plain text file localdata.php Data localdata.php
Accessible without login Plain text file README Doc. README

  Files folder image Files (6)  /  js  
File Role Description
  Accessible without login Plain text file jquery-1.7.2.min.js Aux. jquery-1.7.2.min.js
  Plain text file localdata.js Class localdata.js

 Version Control Unique User Downloads Download Rankings  
 0%
Total:221
This week:0
All time:222
This week:5Up