Check for customer-enabled cookies yourself. If they are not, let him know about the functionality loss and ask him to enable cookies in the browser.
You can test with PHP:
<?php
session_start();
setcookie('compras', $_SESSION['produto'],time()+3600);
header('Location: VerificaCookies.php');
So on the page Verificacookies.php:
if(isset($_COOKIE['compras'])){
echo 'Cookies habilitados';
} else {
// Melhore as mensagens. Estas são só de exemplo
echo 'Cookies desabilitados';
}
EDIT 1: ACCORDING (ALMOST) TO ANDERSON’S COMMENT
There is also the possibility to use Javascript - site W3C (I couldn’t check with Modernizr, because there are blocked websites for me):
if(navigator.cookieEnabled) {
cookies = true;
} else {
cookies = false
}
There’s this other site, Javascript Kit with more complete example also:
<script type="text/javascript">
var cookieEnabled=(navigator.cookieEnabled)? true : false
//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){
document.cookie="testcookie"
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
}
//if (cookieEnabled) //if cookies are enabled on client's browser
//do whatever
</script>
I don’t know if it’ll help you, but you can use the localstorage
– lazyFox
If cookies are turned off not even the session will work, since the session identifier requires the cookie, unless you ignore the minimum security
id
session by URL parameter. You have Localstore and also Websql available in some browsers. But if the person is with cookies turned off he will be with everything else too.– Inkeliz
Nothing prevents you from sending a message, asking you to activate cookies, sometimes :p
– Wallace Maxters