Alex-D / Cookies-EU-banner

1kb vanilla JS script which manages cookies consent banner display like asked by GDPR
http://alex-d.github.io/Cookies-EU-banner/
MIT License
441 stars 57 forks source link

launchFunction is not a function #59

Open GeoffreyOlivier opened 4 years ago

GeoffreyOlivier commented 4 years ago

Hello, I have a error message window is not defined I don't why, I just install and add my script for the file in my nuxt.conf.js. I work with Nuxt JS

import CookiesEuBanner from 'cookies-eu-banner'
export default {
  new: CookiesEuBanner(function () {
    console.log('hello')
  }, true)
}

Sorry for the several edit.

paddotk commented 1 year ago

I have the same issue, but I think the title of this ticket is wrong...

Alex-D commented 1 year ago

This lib is browser-side, not server-side, so it can't be server-side rendered. I do not know much about Nuxt or Next or things like that, but be sure ton put that code on client side only

paddotk commented 1 year ago

@Alex-D I'm also using Nuxt, but made sure to instantiate it client-side. window is available, yet CookiesEuBanner doesn't seem to recognize it (or give the wrong error perhaps).