Thanks, I've tried:
Cookie.write('session', json["cookie"], {domain: 'localhost:4000'});
and no cookie gets written.
Any more ideas?
Jon
On Nov 8, 9:12 pm, "Steve Onnis" <[email protected]> wrote:
> The domain isnt LocalHost in that instance, it is LocalHost:4000
>
> If you specify a port on a host name, the port is also part of the domain,
> just like LocalHost and LocalHost:80 are different
>
>
>
> -----Original Message-----
> From: Jon Hancock [mailto:[email protected]]
> Sent: Monday, 9 November 2009 12:59 PM
> To: MooTools Users
> Subject: [Moo] Cookie.write and dispose acting flaky
>
> My user object has the following methods:
>
> login: function(message){
> new MyDialog({
> caption: 'Please Login',
> url: '/login',
> width: '450px',
> message: message,
> jsonSuccess: function(json){
> dbug.log("LOGIN SUCCESS")
> Cookie.write('session', json["cookie"]);
> user.fireEvent('loggedIn');
> }
> });
> },
> logout: function(){
> dbug.log("LOGOUT");
> Cookie.dispose('session');
> this.fireEvent('loggedOut');
> window.location = '/';
> }
>
> All was working well until I started adding pages with deeper paths.
> The above code works in these two pages: localhost:4000/ and
> localhost:4000/admin But with page localhost:4000/admin/users the
> call to dispose the cookie does not work. The logout function does
> everything correct expect actually dispose the cookie.
>
> According to docs ( I am using mootools
> 1.2.3)http://mootools.net/docs/core/Utilities/Cookie#Cookie:write => In
> order to share the Cookie with pages located in a different path, the
> Cookie.options.domain value must be set.
>
> When I try setting options for domain and path, the call to Cookie
> write does not work:
> Cookie.write('session', json["cookie"], {domain: 'localhost', path:
> '/'});
>
> This is seriously not the path of least surprise. I've tried several
> combinations for options and can't get it to work. All I want is a
> single cookie called "session" to be written or disposed anywhere in
> my app.
>
> Any advice? thanks, Jon