Closed JuliaEichler closed 4 months ago
I have experienced something similar to the described behaviour. I eventually discovered that I had inadvertently "double-loaded" my initialization script.
I haven't done too much digging yet (mainly because my symptoms have gone away - for now at least), but it appears the Chrome balks when the same event is registered more than once.
@JuliaEichler did you follow the guide for angular? You need to make sure the plugin is being loaded on the client side only, when the window
object is available.
Please provide a minimal reproduction.
Here is an example setup with Angular 17.
Oh man, I just found out that this error occurs, when VSCode opens a Chrome browser for testing. If I test it directly in my Chrome which has not been opened by VSCode it works.
I must have tested your example in the VSCode Chrome too.
Sorry for your time and thank your for your hints @nigeldixon and @orestbida!
Expected Behavior
Current Behavior
Works fine in Safari, doesn't happen in Chrome.
Cookie-Consent
Modal doesn't show on first page load
Preferences modal doesn't show on button click
A. Button does nothing:
The proposed button that's suggested in the documentation
<button type="button" data-cc="show-preferencesModal">Manage cookie preferences</button>
does nothing at all. No error is emitted either.B. Calling the preferences modal via typescript:
When calling
CookieConsent.showPreferences()
from the .ts file [CookieService.showSettings() calls CookieConsent.showPreferences();], an error occurs:Steps to reproduce
This happened in previous versions as well. My current setup is as follows:
Angular version 17.1.1 vanilla-cookieconsent version 3.0.0 Browser: Chrome Version 121.0.6167.139 OS: Mac OS 14.3
Doesn't work here either: https://playground.cookieconsent.orestbida.com/
Proposed fix or additional info.
No response
Version
3.0.0
On which browser do you see the issue?
Chrome