简体   繁体   中英

Google Chrome Cookie php problem

I'm having problem with cookies on Google Chrome browser. In other browsers site is working correctly. The problem is that when you sign in and than close browser. When you return you're not logged in at first. If you click on any link, then you'll get logged in. So on first visit cookies don't work. Any ideas how to fix this?

Before you can access a cookie you have to refresh the page. Is is because cookies work like this:

  1. your computer sends the request for a page
  2. the server sends the page (including headers, and along these headers there can be one telling your computer to store a cookie)
  3. when you make another request the computer sends along any previously set cookies

After you set a cookie you have to refresh the page in order to use it.

You say you're using Chrome. If you're running OS X there may be another issue: I just discovered Chrome on OS X does not correctly compensate for time zone differences.

If you are GMT + 4 and you set the cookie to expire in less than 4 hours it will expire right away. If you set it to expire in 4 hours and 10 seconds, it will expire in 10 seconds. It's messed up!

First try erasing all cookies, history etc. Then I suggest you check your size limit, then check your directories(move all the files in 1 place). Chrome supports HTML5 localStorage, try it for larger data. Finally check http/https status

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM