cancel
Showing results for 
Search instead for 
Did you mean: 

cookies with ss_ prefix

cookies with ss_ prefix

Hi guys,

 

We're running a Magento 2 website in a Android webview, but I see some strange cookies which aren't there when I open it on Chrome for example.

 

For example:

 

Cookie 1 : ss_60135074_mage-translation-storage=%7B%7D
Cookie 2 : mage-translation-storage=%7B%7D
Cookie 3 : ss_60135074_mage-translation-file-version=%7B%7D
Cookie 4 : mage-translation-file-version=%7B%7D
Cookie 5 : ls_mage-translation-storage=%5B%5D
Cookie 6 : ls_mage-translation-file-version=%7B%22version%22%3A%22446a60ff1de55c4852bb8a48f9e034ccf71cf170%22%7D
Cookie 7 : form_key=HDiRpQsMEl7iJGcb
Cookie 8 : ss_60135074_mage-cache-storage=%7B%7D
Cookie 9 : ls_mage-cache-storage-section-invalidation=%7B%7D
Cookie 10 : ss_60135074_mage-cache-storage-section-invalidation=%7B%7D
Cookie 11 : ls_mage-cache-timeout=%222016-07-19T08%3A51%3A29.952Z%22
Cookie 12 : ls_mage-cache-storage=%7B%7D
Cookie 13 : mage-cache-storage=%7B%7D
Cookie 14 : mage-cache-storage-section-invalidation=%7B%7D
Cookie 15 : mage-cache-sessid=true

 

There are a lot of cookies with the prefix "ss_[number]", where do these come from? Does anyone know? It all works at first, but eventually it will exceed the 50 cookie limit.

2 REPLIES 2

Re: cookies with ss_ prefix

Same issue. We reach out of cookies limit in Magento2 because of too many cookies with name ss_***_ set.

Have you found any solution?

Re: cookies with ss_ prefix

Apparently, localStorage not available in Android Webview.
And jQuery Storage API Plugin uses cookies as a fallback:
taken from https://github.com/julien-maurel/jQuery-Storage-API/blob/master/jquery.storageapi.js

 

    // Prefix to use with cookie fallback
    var cookie_local_prefix = "ls_";
    var cookie_session_prefix = "ss_";
.....
        // sessionStorage is valid for one window/tab. To simulate that with cookie, we set a name for the window 
        if (!window.name) {
            window.name = Math.floor(Math.random() * 100000000);
        }
......
        if (!storage_available) {
            window.localCookieStorage = $.extend({}, cookie_storage, {
                _prefix: cookie_local_prefix,
                _expires: 365 * 10
            });
            window.sessionCookieStorage = $.extend({}, cookie_storage, {_prefix: cookie_session_prefix + window.name + '_'});
        }
......
        if (storage_available) {
               .....
        } else {
            if (!window.localCookieStorage.getItem(name)) {
                window.localCookieStorage.setItem(name, '{}');
            }
            if (!window.sessionCookieStorage.getItem(name)) {
                window.sessionCookieStorage.setItem(name, '{}');
            }
        }

The following links can help:
http://stackoverflow.com/questions/5899087/android-webview-localstorage
http://stackoverflow.com/questions/26105245/localstorage-html5-feature-not-working-in-webview-on-sam...