0

I've a problem with cookie. This is the code that retrieve the cookie (and has some actions on it):

        var crtg_cookiename = "cto_zodiak";
        var crtg_varname = "crtg_content";
        function crtg_getCookie(c_name) {
            var i, x, y, ARRCookies = document.cookie.split(";");
            for ( i = 0; i < ARRCookies.length; i++) {
                x = ARRCookies[i].substr(0, ARRCookies[i].indexOf("="));
                y = ARRCookies[i].substr(ARRCookies[i].indexOf("=") + 1);
                x = x.replace(/^\s+|\s+$/g, "");

                if (x == c_name) {
                    return unescape(y);
                }
            }
            return '';
        }           
            var crtg_content = crtg_getCookie(crtg_cookiename);

I try this code inside chrome and firefox console: in firefox I can retrieve the cookie and process it but in chrome document.cookie doesn't return anything. Anyone has an idea of the reason?

Thanks in advance

AlessioG
  • 576
  • 5
  • 13
  • 32
  • http://stackoverflow.com/questions/13801181/chrome-cannot-set-cookie-without-server – Hisham Oct 25 '13 at 11:37
  • I think you have very similar problem. Check this link http://stackoverflow.com/questions/335244/why-does-chrome-ignore-local-jquery-cookies – Prateek Oct 25 '13 at 11:38
  • 1
    @MuhammadHisham great! I put the page on apache server http and now I can get the value of the cookie. Thanks! – AlessioG Oct 25 '13 at 12:53

0 Answers0