M
M
mishael2016-04-14 14:14:07
Internet Explorer
mishael, 2016-04-14 14:14:07

Cookie not set for domain in IE11. What to do?

<?
@$tmp = $_COOKIE['phpbb3test'];
header('Set-Cookie: phpbb3test='.time().'; expires=Tue, 11-Apr-2017 21:16:00 GMT; path=/; domain=.xt.ht; HttpOnly');

echo 'phpbb3test was '.$tmp.'<br> ';
echo 'Set-Cookie: phpbb3test='.time().'; expires=Tue, 11-Apr-2017 21:16:00 GMT; path=/; domain=.xt.ht; HttpOnly<br><br> PRESS F5';
?>

But the file itself - open in IE and in a normal browser.
xt.ht/phpbb/1.php
In short, this line does not set the cookie :(
I googled the bug that the cookie is not set with the wrong date and time. But here it seems to be just what you need.
The experiment showed that in the form
header('Set-Cookie: phpbb3test=1111;    HttpOnly');

it works fine.
And so too
header('Set-Cookie: phpbb3test=1111; expires=Tue, 11-May-2016 21:16:00 GMT; HttpOnly');

domain and path spoil everything. I checked the domain of norms according to RFC like (underscores do not roll there). Tried with and without a dot. The path tried with /phpbb/ and correct.
What is a pancake?
Yes, I checked this code on other domains :( I checked to remove from the folder to the root - it doesn’t work anyway.
Windows eight-64. IE 11.0.9600
The problem is reproduced on other computers from other people. But on some computers with 11 IE ten everything works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-04-15
@mishael

I threw myself a similar script and checked it in Win8 IE10.
I left the date as you have now, incorrect Tue, 11-May-2016 21:16:00 GMT
Visually, both your and my script set the cookie in the same way, but IE10 passes the cookie to my script, but not to yours.
Now, from the obvious differences, this is the domain name - I have a "regular" domain - long and in the ru zone, and you have a very short one and in the "strange" .ht zone.
There is a suspicion that this is the case.
UPD. Just now I noticed that you have already tried other domains.
UPD2. It seems legs grow from here - https://support.microsoft.com/en-us/kb/310676- "Internet Explorer does not set a cookie for two-letter domains". This, of course, is about very old versions, but the symptoms are very similar, then Microsoft advised "do not use a domain name with less than three letters". That is, your domain is treated as a potential TLD like .co.uk, hence the inability to set cookies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question