Skip to content

Commit

Permalink
Fix cookie settings page crash in IE11
Browse files Browse the repository at this point in the history
URL is unsupported in IE11, so use try/catch for this value
  • Loading branch information
AshGDS committed Mar 1, 2024
1 parent 7c73901 commit 4a5689c
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -102,7 +102,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
}

CookieSettings.prototype.getReferrerLink = function () {
return document.referrer ? new URL(document.referrer).pathname : false
var documentReferrer = false
try {
documentReferrer = document.referrer || new URL(document.referrer).pathname
} catch (e) {
console.error('Error grabbing referrer for cookie settings', window.location, e)
}
return documentReferrer
}

Modules.CookieSettings = CookieSettings
Expand Down

0 comments on commit 4a5689c

Please sign in to comment.