Cookie Confusion - How Can I Read a Cookie Value on Another Page?

Hey folks…

I’m implementing the “Creating a Cookie Consent Alert” feature as @teodor explains in the post below.

The method describes is based on using a cookie called “notification” to show if the visitor has approved the use of cookies as he visits the site. Once this is set, the “Cookie Consent alert” no longer displays.

While this works well for one page of a web site, I need each page of my site to be able to recognise the value of this cookie and decide whether to display the Cookie Consent Alert or not… as users could first arrive at my site on pages other than the home page.

To make the code as simple as possible, I’ve put the code for the cookie manager and the alert into a server side include (ssi_cookie_alert.php), and am including this on each page of my web site… see below.

However, when I visit other pages than the one the cookie was set on, the cookie’s value cannot be read, so the Cookie Consent Alert still displays.

Clearly I’m doing something wrong… is it:

  1. That cookies cannot be read across pages?
  2. Using the SSI is causing issues? Maybe I can only have one Cookie-Manager per site rather than per page?
  3. That cookies can’t be read across pages and I need to use the State Manager in some way too?

I’d love to know the best way forwards!

Best wishes,


<!-- Wappler include head-page="index-cookies.php" appconnect="local" is="dmx-app" bootstrap5="local" fontawesome_5="local" components="{dmxBootstrap5Alert:{},dmxStateManagement:{}}" id="ssi_cookie_alert" -->
<script is="dmx-flow" id="flow_enable_cookies" type="text/dmx-flow" src="app/flows/flow_enable_cookies.json"></script>
<script is="dmx-flow" id="flow_disable_cookies" type="text/dmx-flow" src="app/flows/flow_disable_cookies.json"></script>

<dmx-cookie-manager id="cookies1"></dmx-cookie-manager>
<div class="alert text-center mb-0 pt-4 bg_purple1" id="alert_cookies" is="dmx-bs5-alert" role="alert" type="secondary" dmx-bind:show="(!=1) && (!=0)">
    <div class="row justify-content-around">
        <div class="col maxw_600">
            <p class="c_purple6">We'd like you to know that our website uses cookies!<br><br>They allow us to better understand how our website is used, and to connect the site to advertising services.<br><br>You can&nbsp;<a href="" target="_blank">click here</a> to read more about general cookie use.</p>
            <div class="d-flex justify-content-around mt-5"><button id="b_cookie_disable" class="btn btn-sm ml-5 btn-link c_purple6" dmx-on:click="cookies1.set('notification',0,{expires: 90});" wappler-command="editContent">Disable cookies</button><button id="b_cookie_continue" class="btn btn-secondary btn-sm mr-5 bg_purple3 border-0" dmx-on:click="cookies1.set('notification',1,{expires: 90});" wappler-command="editContent">Continue with cookies</button></div>

Community Page
Last updated: