Actually the whole question is in the title: there is any way to use pure jquery for manipulating cookies? i do not want to use some other js-library except jquery ... Thank you!
Asked
Active
Viewed 216 times
0
-
1Why don't you want to use plugins? Jquery-Cookie provides a very clean way to deal with cookies and literally reduces your effort in cookie handling. This post might help U even more http://stackoverflow.com/questions/95213/can-jquery-read-write-cookies-to-a-browser – Talha Masood Dec 14 '13 at 09:47
-
And yes its very true that Jquery does not provide any built in cookie handling method. You can however do cookie manipulation with pure JavaScript. – Talha Masood Dec 14 '13 at 09:48
1 Answers
3
No. jQuery has no cookie-handling built in. You either use a plug-in, or you do the work yourself (with JavaScript but without jQuery) via document.cookie
.

T.J. Crowder
- 1,031,962
- 187
- 1,923
- 1,875
-
so i can use pure javascript? i accept as a good answer pure javascript too – Catalin Sterian Dec 14 '13 at 09:38
-
@CatalinSterian: Of course you can; the plug-ins for jQuery that handle cookies are written in JavaScript. So you can write your own code to handle it. But frankly, this problem *has been solved*. I'd use the solution someone has already built and made available to you for free, rather than writing your own. Parsing a cookie from the insanely-badly-designed `document.cookie` property is a pain. The minified version of [this plugin](https://github.com/carhartl/jquery-cookie) is 1,750 characters. That's hardly going to bloat your project. – T.J. Crowder Dec 14 '13 at 09:47
-
thank you. i will start reading, i actualy don`t want to use a plugin that is not necessary ... – Catalin Sterian Dec 14 '13 at 09:50
-
@CatalinSterian: You can write your own code to do it, which is unlikely to be smaller, or use code that's already written, debugged, and used by thousands of other people. Your call. :-) – T.J. Crowder Dec 14 '13 at 09:51