[ 6 posts ]

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

YUI Cookie Utility and Chrome

Post Posted: Tue Jun 26, 2012 2:38 pm
+0-
The following code works in IE and FF, but not in Chrome.

Code:
<html>
<head>
    <script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
    <script type="text/javascript">
        YUI().use('handlebars', 'node-base','cookie', function (Y) {

            Y.Cookie.set('hi', 'bye');
            alert(Y.Cookie.get('hi'));

        });
    </script>
</head>
<body>
</body>
</html>


Any ideas?

Thanks.

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: YUI Cookie Utility and Chrome

Post Posted: Wed Jun 27, 2012 1:34 am
+0-
Hello Daniel.

With Chrome 19 and 20 it works fine:
http://jsfiddle.net/m2gUK/

Regards,
IceBox

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

Re: YUI Cookie Utility and Chrome

Post Posted: Wed Jun 27, 2012 9:18 am
+0-
Hi Alberto,

It alerts a null value for me in Chrome 19 and Chrome 20. I just got an update to Chrome 20 so I was able to test with Chrome 20 as well.

For both IE 9 and FF13 it alerts 'bye'...

Wonder what's going on....

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: YUI Cookie Utility and Chrome

Post Posted: Wed Jun 27, 2012 9:58 am
+0-
Hello Daniel.

On my box (windows 7 and chrome 20) it works fine, alerting 'bye'.

Maybe a cache or profile issue.

Regards,
IceBox

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

Re: YUI Cookie Utility and Chrome

Post Posted: Wed Jun 27, 2012 10:35 am
+0-
Hi again :)

I tried debugging the issue and it seems that the "set" method in Cookie.js is not working for Chrome. The "doc.cookie" is not set with the value from "text".

It's wierd b/c I see that text has the value "hi=bye", but doc.cookie never gets set. It remains an empty string for me.

When I debug in FF, I see that the doc.cookie contains other cookie values and that new cookies can be set.

Code:
var text = this._createCookieString(name, value, !options.raw, options);
doc.cookie = text;  // even though text = "hi=bye", doc.cookie does not get updated with this value!
return text;


note: doc is defined for chrome - no exceptions are being thrown. The value just wont get set!

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

Re: YUI Cookie Utility and Chrome

Post Posted: Mon Jul 09, 2012 4:20 pm
+0-
Quick update:

I downloaded the YUI test files for the cookie utility and all the tests run fine in chrome. In production, if I try to use the feature that relies on the cookie utility, then this runs fine as well in chrome. Only when I try to run the tests locally does the test fail in chrome. So odd... but I'm glad it's working in production.
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum