diff --git a/lib/api.ts b/lib/api.ts index 174dc97f2..c4abc7ffb 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -14,7 +14,7 @@ export class API { url.searchParams.set("ts", `${Date.now()}${Math.random()}`); url.searchParams.set("version", version); return fetch(url.href, { - referrerPolicy: "strict-origin-when-cross-origin", + referrerPolicy: this._options.referrerPolicy, }); } diff --git a/lib/optionInterfaces.ts b/lib/optionInterfaces.ts index ee91885cd..934783d99 100644 --- a/lib/optionInterfaces.ts +++ b/lib/optionInterfaces.ts @@ -11,6 +11,7 @@ export interface PeerJSOption { token?: string; config?: RTCConfiguration; debug?: number; + referrerPolicy?: ReferrerPolicy; } export interface PeerConnectOption { diff --git a/lib/peer.ts b/lib/peer.ts index 2f4b2c0b2..60e49567f 100644 --- a/lib/peer.ts +++ b/lib/peer.ts @@ -29,6 +29,7 @@ class PeerOptions implements PeerJSOption { config?: any; secure?: boolean; pingInterval?: number; + referrerPolicy?: ReferrerPolicy; logFunction?: (logLevel: LogLevel, ...rest: any[]) => void; } @@ -164,6 +165,7 @@ export class Peer extends EventEmitter { key: Peer.DEFAULT_KEY, token: util.randomToken(), config: util.defaultConfig, + referrerPolicy: "strict-origin-when-cross-origin", ...options, }; this._options = options;