Next.js Discord

Discord Forum

beforeInteractive not working on 404 page

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Hi everyone.
Im having issue with OSANO cookie consent. It is added into Root layout with strategy="beforeInteractive" :
<Script
strategy="beforeInteractive"
src={OSANO_URL}
/>
But it is not being initialized on first load (when we go directly to 404 url on incognito mode).

I even created repository to reproduce:
https://github.com/kacyee/before-interactive-2
When we add function "notFound()" on page, we cant see
console.log("I should be beforeInteractive"); <- this is script initialized with strategy "beforeInteractive" on root layout.
But when we remove "notFound()" from page, everything works fine.

It is super crucial for me to have OSANO on every page ,even on 404.

5 Replies

Hi there, please don’t delete old posts only to repost them. You can bump old posts.
See also:
Barbary LionOP
Alright 🙂
Barbary LionOP
bump
Barbary LionOP
bump