jQuery serverCookieJar

Introduction

After work on the jQuery plugin cookieJar it was pointed out that cookie data is sent with every request and that cookies have a limit of 4KB, this got me thinking. What about storing this information on the server.

This is done by making a request to the server when the page first loads with a request for the data. Then only any changes are sent to the server when something changes. This adds the size of this data for the page to the down traffic (much faster than the up traffic) occurring just once per page, rather than the up traffic for every request on a page.

Requirements

Requirements to use this code

Compatibility

So far the plugin has been tested in windows using the following browsers.

Usage

This plugin is designed as an alternative to cookieJar. See it’s doc’s and usage examples

Note: This plugin uses async:false option on ajax. This means when a serverCookieJar object is created for the cookieJar it makes a request to the server for that cookieJar, the browser will pause until the cookieJar has been retrieved from the server, the larger the serverCookieJar or the slower the server the longer this will take.

Example

jquery.servercookiejar.example.html

Downloads

Here are the downloads

jquery.servercookiejar.js (7.2KB)
jquery.servercookiejar.pack.js (2.4KB)
jquery.servercookiejar.php (0.7KB)