How To Read/write Cookies For Local File:/// Html Document?
How can I read/write cookies for local file:/// HTML document using Javascript or jQuery? I tried this one >> function setCookie(c_name, value, exdays) { var exdate = new D
Solution 1:
It depends on your browser. Chrome e.g. doesn't allow cookies for local files. see: where cookie saved for local HTML file
Solution 2:
This will work locally
// save data valuelocalStorage.setItem("name", "John");
// retrieve data valuevar name = localStorage.getItem("name");
Solution 3:
try this one:
https://github.com/carhartl/jquery-cookie
If you need multiple values stored in it try this:
Solution 4:
As an alternative to loading the page from file, you can run a webserver and load the page from localhost. Apache comes with OSX and Ubuntu. Once you have set that up you will be able to use cookies on the local page.
Solution 5:
Try in different browser mozilla allows local storage cookies
Post a Comment for "How To Read/write Cookies For Local File:/// Html Document?"