Skip to content

Commit 2147c9e

Browse files
authored
Merge branch 'master' into jstirnaman/issue5159
2 parents de522a7 + e85951d commit 2147c9e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

assets/js/v3-wayfinding.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Store the host value for the current page
2-
currentPageHost = window.location.href.match(/^(?:[^\/]*\/){2}[^\/]+/g)[0];
2+
const currentPageHost = window.location.href.match(/^(?:[^\/]*\/){2}[^\/]+/g)[0];
33

44
// Define v3-wayfinding elements
55
var wayfindingModal = document.getElementById('v3-wayfinding-modal');
@@ -55,6 +55,9 @@ function slideUp (elem) {
5555
* - Has the user opted out of the wayfinding modal?
5656
*/
5757
function shouldOpenWayfinding () {
58+
// Extract the protocol and hostname of referrer
59+
const referrerMatch = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g);
60+
const referrerHost = referrerMatch ? referrerMatch[0] : '';
5861
var isExternalReferrer = !referrerWhitelist.includes(referrerHost);
5962
var wayfindingOptedOut = getPreference(wayfindingPrefCookie);
6063

0 commit comments

Comments
 (0)