magento 2.4.2 updated get The store will not work correctly in the case when cookies are disabled

magento.stackexchange https://magento.stackexchange.com/questions/336460

Domanda

When I upgraded my webiste from M2.3.5 to M2.4.2, I get this notice "The store will not work correctly in the case when cookies are disabled." on top of head frontend for 3 seconds. But I installed a new M2.4.2 have not get that notice(Cookie Restriction Mode = No) . I found div id named "cookie status" The store will not work correctly in the case when cookies are disabled. but I can't find which file can control this. I don't need the notice display, so how to do that? Thanks

enter image description here

enter image description here

enter image description here

È stato utile?

Soluzione

It's taking time to hide because there is using js for hide. you can use css for hide instaed of $script = 'document.querySelector("#cookie-status").style.display = "none";';

Content comes from vendor/magento/module-theme/view/frontend/templates/js/cookie_status.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>

<div id="cookie-status">
    <?= $block->escapeHtml(__('The store will not work correctly in the case when cookies are disabled.')); ?>
</div>
<?php
$script = 'document.querySelector("#cookie-status").style.display = "none";';
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', ['type' => 'text/javascript'], $script, false); ?>

<script type="text/x-magento-init">
    {
        "*": {
            "cookieStatus": {}
        }
    }
</script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top