mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
Set cookie on document host by removing domain
Cookies using the hostname as a domain will be set with a prefix of `.` by browsers, it seems to ensure all subdomains are included in the scope. When deleting the `seen_cookie_message` cookie we want to set its domain without a `.` prefix, to match the domain set by the original code. Leaving the `domain` attribute out from the cookie string will ensure the `.` prefix is not set.
This commit is contained in:
@@ -9,7 +9,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
||||
|
||||
// clear old cookie set by our previous JS, set on the www domain
|
||||
if (window.GOVUK.cookie('seen_cookie_message')) {
|
||||
document.cookie = 'seen_cookie_message=;expires=' + new Date() + ';domain=' + window.location.hostname + ';path=/';
|
||||
document.cookie = 'seen_cookie_message=;expires=' + new Date() + ';path=/';
|
||||
}
|
||||
|
||||
if (consent === null) {
|
||||
|
||||
Reference in New Issue
Block a user