Home >Web Front-end >JS Tutorial >Detailed explanation of jquery.cookie of micro plug-in
Handling cookies through native JavaScript is a headache, and jquery itself does not have it Solve the function that handles cookies,
But this extremely small (about 500 bytes after compression) jquery plug-in can be used to handle the reading, writing and deletion of cookies .
IE6+, Chrome, Firefox, Safari, Opera
Dependency framework: jQuery1.0+
No modules are supported yet
1. Create cookies through the $.cookie.write method, the sample code is as follows:
$.cookie.write('cookie_name', 'cookie_value', 24 * 60 * 60);
2. Read the cookie through the $.cookie.read method, the sample code is as follows:
$.cookie.read('cookie_name')
3. Delete the cookie through the $.cookie.destory method, the sample code is as follows:
$.cookie.destroy('cookie_name')
github.com/stefangabos/Zebra_Cookie/
Authorization type: LGPL
Authorization type information: github.com /stefangabos/Zebra_Cookie/blob/master/license.txt
stefangabos.ro/jquery/zebra-cookie/#changelog
The plug-in has not been officially encapsulated as a module. You can refer to segmentfault.com/blog/liangyi/1190000000759569 for encapsulation.
The above is the detailed content of Detailed explanation of jquery.cookie of micro plug-in. For more information, please follow other related articles on the PHP Chinese website!