fix: comment scripts bypass cookie consent (#1308)
* fix: comment scripts bypass cookie consent When GDPR cookie consent is enabled, the comments container is simply hidden with CSS. However, this still allows all third-party script tags within the container to be evaluated and downloaded by the browser. This PR uses the <template> tag which stops inner scripts from evaluating. Once consent is granted, the template content is cloned and inserted into the container, and the scripts are manually loaded in order. * refactor(comments): move consent-gated loader to TS asset * fix(comments): add integrity attribute to comments consent script * style: align comments consent docs and naming * refactor(comments): simplify script handling --------- Co-authored-by: Jimmy Cai <jimmy@cai.im>
This commit is contained in:
@@ -175,6 +175,7 @@ class CookieConsent {
|
||||
}
|
||||
|
||||
private dispatchConsentEvent(): void {
|
||||
// Cross-module event consumed by consent-gated features (for example commentsConsent.ts).
|
||||
const event = new CustomEvent('onCookieConsentChange', {
|
||||
detail: this.state
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user