I've got the following:
User clicks on a link mydomain.com/redirect.php
where gets a cookie (for mydomain.com) via setcookie
function and then goes to another page (header('Location: ...');
) - say lp.html
Then, on that page there is a script:
gs('mydomain.com/getcookie.php', 'client=52', function() {});
and this function is as follows:
gs = function(path, args, fn) {
var p = document.head || document.getElementsByTagName("head")[0]
var s = document.createElement("script");
p.appendChild(s);
if (fn) {
if (s.addEventListener) {
s.addEventListener('load', fn, false);
} else if (s.attachEvent) {
s.attachEvent("onload", function() {
fn(window.event)
});
} else {
s["onload"] = fn;
}
s.onreadystatechange = function() {
fn()
}
}
s.src = path + "?" + args;
}
The getcookie.php
script gets a value from $_COOKIE
(since it's on my domain) and returns a small js, like this: myParam = 'cookieValue';
for later use in js.
So, this works well... except Internet Explorer. It works there only if I manually allow it to accept all cookies.
answer: (thanks to duellsy)
adding
header('P3P: CP="CAO PSA OUR"');
header('P3P: CP="HONK"');