User with browser cookies disabled

1

I have a system and I use cookies to temporarily save an information, but I noticed a problem with a certain user and when trying to solve the problem, I noticed that it had cookies disabled (do not ask me why).

I cook the cookies in a conventional manner by php

setcookie(...);

So, these are my questions:

  • How can I tell if a user has their browser cookies disabled?
  • If yes, how should I proceed?
  • asked by anonymous 01.08.2018 / 16:51

    1 answer

    1

    I believe that with PHP it will not be possible, but you can try in javascript, something like:

    <script type="text/javascript">
    
    var tmpcookie = new Date();
    
    chkcookie = (tmpcookie.getTime() + '');
    
    document.cookie = "chkcookie=" + chkcookie + "; path=/";
    
    if( document.cookie.indexOf(chkcookie,0) < 0 )
    {
        alert('Cookie desabilitado');
    }
    else
    {
        alert('Cookie habilitado');
    }
    
    </script>
    

    Reference

        
    01.08.2018 / 16:59