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 4, 2024
1 parent 6767a8d commit 6a096f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

* Allow custom text for GA4 scroll tracker ([PR #3896](https://github.com/alphagov/govuk_publishing_components/pull/3896))
* Ensure analytics stops firing if a user disables usage cookies on our cookie settings page ([PR #3893](https://github.com/alphagov/govuk_publishing_components/pull/3893))
* Fix cookie settings page crash in IE11 ([PR #3894](https://github.com/alphagov/govuk_publishing_components/pull/3894))

## 37.5.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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 6a096f6

Please sign in to comment.