Skip to content

How can I load different CSS files when no consent has been given? #259

Answered by fritzmg
Fanni-Portier asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can do that via a custom script that will only be executed once consent was given. See https://github.com/oveleon/contao-cookiebar/blob/master/docs/EXTENDED_USAGE.md

const link = document.createElement('link');
link.href = '…';
link.rel = 'stylesheet';
document.head.append(link);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zoglo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #108 on January 08, 2025 17:18.