Support and Docs

3 Topics
Last post 11 November 2014 By Nadja Kristiansen
1 Topics
Last post 20 March 2014 By Carsten E. Madsen
0 Topics
Last post N/A By N/A
0 Topics
Last post N/A By N/A
1 Topics
Last post 02 April 2014 By Carsten E. Madsen
Login

You need to log in, in order to contribute to the community.

Disabled session cookies

Carsten E. Madsen 5 Posts 11 Karma
Carsten E. Madsen posted this 19 December 2013

I recently had an issue where a B2B shop owners customers were unable to login to the shop. Not all customers but some. We looked extensively at the problem and because we were unable to reproduce the problem, we even talked to a few of the customers. It turns out that the customers experiencing the problem was browsing from a Windows Server 2012. At even close inspection it turns out that in this particular Operating System, session cookies are disabled by default.

The symptoms we saw was:

Submitting the customer login form did not result in log in and no errors was returned

eSeller Cloud is highly dependent on Session cookies. For instance, session cookies are used to make sure that a particular user is shown his particular basket with his products. Session cookies are also used to check if a user is logged in. To fix the problem the affected users had to enable session cookies in their browsers and suddenly everything worked.

It is very uncommon for browser not to support session cookies and it is not a problem I expect to encounter again in the near future but it may be relevant to detect if a user has session cookies disabled and to let the user know that something is not quite right.

An easy way to detect disabled cookies is to add a some javascript to the html header section of the shop.

The html header section is found at “Home >> Marketing >> Html header”
 
The following script will display a warning pop-up to users with disabled cookies. You may want to change the behavior or add some information about how to change cookie settings but the below javascript should offer a reasonable starting point:

<script type="text/javascript">

$( document ).ready(function() {

if(!cookiesEnabled(event)){

alert('Cookies er slået fra\nVi kan desværre ikke logge dig ind da din browser ikke understøtter cookies.\nShoppen anvender cookies til at holde styr på om du er logget ind.\n\nKontakt din lokale administrator eller it supporter for at få cookies slået til');

}

 

});

function cookiesEnabled() {

    var cookieEnabled = navigator.cookieEnabled;

 

    // When cookieEnabled flag is present and false then cookies are disabled.

    if (cookieEnabled === false) {

        return false;

    }

 

    // try to set a test cookie if we can't see any cookies and we're using

    // either a browser that doesn't support navigator.cookieEnabled

    // or IE (which always returns true for navigator.cookieEnabled)

    if (!document.cookie && (cookieEnabled === null || /*@cc_on!@*/false))

    {

        document.cookie = "testcookie=1";

 

        if (!document.cookie) {

            return false;

        } else {

            document.cookie = "testcookie=; expires=" + new Date(0).toUTCString();

        }

    }

 

    return true;

}

</script>

3