I'm having issues setting session cookies in Internet Explorer 3.0. Does anyone know if there is something special that needs to be done?
I'm doing with PHP, like so: setcookie('test', '1');
I'm not using a path or expiration time, is that necessary?
Perhaps someone has some old experience, or a 1997-1998 web development book laying around?
In case anyone is wondering why I'm bothering with this, because no-one uses IE3 anymore, and it's hard, yadda yadda, it's an art project.
Edit: Just to clarify, I have not tried setting cookies via JS yet, this is being done via HTTP.
So I've gotten to the bottom of this issue, and there were three causes for my confusion:
First, if you don't set a path= parameter for the cookie, IE3 will assume that the cookie is for this exact path only. This means that it will send back the same cookie when accessing /test.php
again, but nowhere else on the site.
The solution is to include path=/ when setting the cookie.
Second, IE3 does not recognize cookies without an Expires parameter. The solution is to include Expires= in the Set-Cookie header, in "standard" cookie format.
The third is caused by the new Max-Age parameter, helpfully added by PHP for some reason, which IE3 does not recognize. Instead, it assumes everything up to and including Max-Age is the cookie name.
The solution is to set the cookie using PHP's header()
function instead, like so:
header('Set-Cookie: test2=hi; expires=Tue, 02-Feb-2021 04:20:00 GMT; path=/');
(In this case, test2 is the name of the cookie, hi is the contents, and it expires about a year from today, on Feb 2nd.)