diff --git a/src/common/utils/kaltura-params.ts b/src/common/utils/kaltura-params.ts index 42fc7bcbf..daa008b6b 100644 --- a/src/common/utils/kaltura-params.ts +++ b/src/common/utils/kaltura-params.ts @@ -15,6 +15,12 @@ const SIGNATURE = 'signature='; const SEEK_FROM = 'seekFrom='; const CLIP_TO = 'clipTo='; +declare global { + interface Window { + originalRequestReferrer?: string; + } +} + /** * @param {Player} player - player * @param {PartialKPOptionsObject} playerConfig - player config @@ -107,7 +113,10 @@ function getReferrer(): string { referrer = window.parent.document.URL; } catch (e) { // unfriendly iframe - referrer = document.referrer; + + // try to get it from originalReferrer supplied by backend + // or fallback to document referrer + referrer = window.originalRequestReferrer || document.referrer; } return referrer; }