cookieconsent
cookieconsent copied to clipboard
[Docs]: I couldn't make a event listener listen for cookie change and reload the page
Hello,
I have a question how can i make a listener that listens for cookie withdraw or change and make the page reload.
Best regards, ItsSharkFinStudio
You can use onChange callback. See documentation.
CookieConsent.run({
categories: {
necessary: {
readOnly: true,
enabled: true,
},
analytics: {},
ads: {},
},
language: {
default: 'en',
translations: {
en: './en.json',
},
},
onChange: () => {
location.reload();
},
});
Oh thanks man but i have a question if i change cookie consent to deny the cookies remain loaded and if i reload the page they disappear do i need to make it reload the page on cookie consent change or not?
Best regards, ItsSharkFinStudio