Skip to content

Commit e85951d

Browse files
authored
Merge pull request #5733 from influxdata/jstirnaman/issue5732
hotfix(wayfinding): make sure referrerHost is assigned in v3Wayfindin…
2 parents 90a740e + 3e64fa1 commit e85951d

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)