I set cookies (in Magento 2.3.1 EE) with this code below:

<script type="text/javascript">
], function ($) {
    $(document).ready(function () {
        var check_cookie_store_source = $.cookie('StoreSource');
        var check_cookie_store_locator_store_id = $.cookie('store_locator_store_id');
        console.log('set Just In');
        if (!check_cookie_store_source){
            $.cookie('StoreSource', '5');
            console.log('set check_cookie_store_source');
        if (!check_cookie_store_locator_store_id){
            $.cookie('store_locator_store_id', '10');
            console.log('set check_cookie_store_locator_store_id');

So Now, I need to have magento2.docker in domain name not .magento2.docker (check dot before).

I also use this sentaxe :

$.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'magento2.docker' });

I continue to get dot(.) before my domain name, please help me understand and solve this probleme My Console Cookies log in my brower

Thank you


Cookie domains with a prefix . are set by the server when your browser receives a response, and cookies created with javascript are without the prefix.

You do not need the dot (.) before the domain, and subdomains will work under the parent domain.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.