Hi Guys

I am currently setting up a cookie message to tell users of the site that cookies are being used (EU cookie law)

I have managed to get this working on all desktop browsers, however I am having issues with mobile device ie iPhone, iPad, Galaxy tab etc

I am using the following to set the cookie once the accept button has been pressed.

setcookie("acceptCookies","yes",time()+(86400*60),"/","domain.co.uk");

To detect if a cookie is set I am using

if(!isset($_COOKIE["acceptCookies"])) {
    echo('show cookie message');
}

Is anyone able to see if I have missed something so it works on mobile devices, I have checked the device and cookies are set to be accepted on the devices.

Thanks
Shuka

Recommended Answers

All 2 Replies

Try to get this cookie variable using **JavaScript** and say what the results.
Member Avatar for diafol
setcookie("acceptCookies","yes",time()+(86400*60),'/',"example.com",false,false);

seems to work for me.

setcookie("acceptCookies","yes",time()+(86400*60),'/',"blacknun.diafol.org",false,false);

if(!isset($_COOKIE["acceptCookies"])) {
    echo('show cookie message');
}else{
        echo $_COOKIE['acceptCookies'];
}

Try your mobile to - 'blacknun.diafol.org/cookie.php' . Worked perfectly on my HTC.

I'll be deleting this shortly - so post back once you've tried it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.