[ACCEPTED]-Why does Chrome ignore local jQuery cookies?-google-chrome
Chrome doesn't support cookies for local 7 files (or, like Peter Lyons mentioned, localhost*) unless 6 you start it with the --enable-file-cookies 5 flag. You can read a discussion about it 4 at http://code.google.com/p/chromium/issues/detail?id=535.
*Chrome does support cookies if you use 3 the local IP address (127.0.0.1) directly. so 2 in the localhost case, that could be an 1 easier workaround.
For local applications use localStorage 1 in Chrome instead: http://people.w3.org/mike/localstorage.html
i had some problem and solved it this terrible 3 solution. using store and cookie plugin 2 together.
<script src="js/jquery.cookies.2.2.0.js" type="text/javascript"></script>
<script src="js/jquery.Storage.js" type="text/javascript"></script>
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
//get cookies
var helpFlag=(is_chrome)?$.Storage.get("helpFlag"):$.cookies.get("helpFlag");
//set cookies
if(is_chrome)$.Storage.set("helpFlag", "1");else $.cookies.set("helpFlag", "1");
I know that this isnt perfect solution 1 but works for me
This did the job for me:
Right click on your 3 Chrome Icon and select Properties, Shortcut 2 tab and add --enable-file-cookies at the 1 last of the target path.
I had the same issue, please try using the 2 IP address of localhost instead. For e.g 1 "http://127.0.0.1/yoursite/"
please check out Cookies & Google Analytics.
$.cookie("nameofcookie", cookievalue, {path: "/", expires: 30});
change this line to
$.cookie("nameofcookie", cookievalue, {*Path:* "/", expires: 30});
this 1 project working is fine.
Another possible cause is the path: "/"
, since you're 3 not using a normal web URL, /
probably doesn't 2 mean much - try without setting the path 1 at all.
If you use chrominum this is the command 3 to enable local cookies
chromium-browser 2 --enable-file-cookies
It's the same thing 1 for chrome
Hope this help you !
As workaround you can use Tampermonkey with 7 access to local files ( How to include Local htm pages in a Tampermonkey script? ) By that way you 6 will use Tampermonkey's storage, and will 5 be able to set and get your data by functions 4 GM_getValue(data) and GM_setValue(data). I 3 used that for my local HTML page, which 2 i used as customizable alternative to Windows 1 Explorer
But actually localStorage from Yuri's answer works perfect.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.