http://www.baidu.com where baidu.com is a domain name. So is localhost in http://localhost a domain name? I googled it and found that someone said it was a domain name. So I added the cookie like this after logging in in my web project:
Refer to this article for details