Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs]: I couldn't make a event listener listen for cookie change and reload the page #757

Open
ItsSharkFinStudio opened this issue Nov 30, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation triage yet to be reviewed

Comments

@ItsSharkFinStudio
Copy link

ItsSharkFinStudio commented Nov 30, 2024

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

@ItsSharkFinStudio ItsSharkFinStudio added the documentation Improvements or additions to documentation label Nov 30, 2024
@github-actions github-actions bot added the triage yet to be reviewed label Nov 30, 2024
@ItsSharkFinStudio ItsSharkFinStudio changed the title [Docs]: Cookie Banner Script Disappears After 2 Refreshes [Docs]: I couldn't make a event listener listen for cookie change and reload the page Dec 2, 2024
@OndraM
Copy link
Contributor

OndraM commented Dec 17, 2024

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();
  },
});

@ItsSharkFinStudio
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation triage yet to be reviewed
Projects
None yet
Development

No branches or pull requests

2 participants