Forum Moderators: coopster
if (isset($_COOKIE['testcookies']))
//sharweet
} else {
//doh
}
OK
My question this only works if a user refreshes or goes to a second page as setcookie is set after pager is rendered there fore you won't know on the first hit of your site.
Is there a way to tell if cookie are enable from the first time they hit your site
IE I want to do a cookie check on my homepage but noticed this problem
Anyone have any workarounds
I don't want to do meta-refresh or and hacks like that, But would be interesting to hear any ideas you have anyhow :)
As I understand it, there is not a way to do that. Cookies are sent through the HTTP headers, so when the browser sends a request to the server, the server responds with page type, size, etc., and the cookies to be set along with the actual page (or image, whatever). If you have any cookies set, they are sent with the initial request being sent to the server.
Since the request has already been sent before any cookies were set, the server can't tell if the cookie was accepted. The only way for the server to tell would be for the browser to send out a new request, ie for a new page.
Don't know if that made any sense, if not, let me know and I'll try to clear out the muckiness.
Chad