Wednesday, November 14, 2007

Safari won't set cookies from javascript on localhost

Ran into this today - if you're testing your work with Safari, it won't set cookies from javascript on localhost. Hit you local box using 127.0.0.1 and it will work. Grrrrr :(

2 comments:

said...

Is this Safari 2 or Safari 3? And have you filed a Radar yet?

One thing I do is I have my /etc/hosts configured to map my machine name to 127.0.0.1. So for example:

127.0.0.1 jwatkins
127.0.0.1 jwatkins.xpple.com

That way, the URLs I use locally (and when not connected to either the corporate network or the VPN) still work when I email them to colleagues.

This also conveniently gets around the localhost cookie issue.

said...

Oh, yes! Thanks for the 127.0.0.1 fix... I have been wondering about this cookie thing myself, since Devshop uses cookies to transmit "commands" back to the server...