Popular Posts

Total Pageviews

Monday, August 12, 2013

Chrome doesn't set cookies for domain "localhost"

A recent problem has been popped up in chrome, since some time they don't allow user to set cookie for domain localhost. So if you are using this code in php for setting the cookie
setcookie ( $name , $value , $expire , $path , "localhost", $secure , $httponly )

then just change the above code to this
setcookie ( $name , $value , $expire , $path , "", $secure , $httponly )

or

setcookie ( $name , $value , $expire , $path , null, $secure , $httponly )


it will work and will not hamper your development activities. Anyway you are going to change this code on production.