From eb30ea969378a1df3d76d06b8da95bf06551e826 Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Mon, 13 Nov 2017 16:29:38 -0600 Subject: [PATCH] fix(alwaysontop): URLs for the additionally loaded resources. --- modules/API/external/external_api.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index a2093c33a..962edda2a 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -215,7 +215,6 @@ export default class JitsiMeetExternalAPI extends EventEmitter { noSSL, roomName }); - this._baseUrl = `${noSSL ? 'http' : 'https'}://${domain}/`; this._createIFrame(height, width); this._transport = new Transport({ backend: new PostMessageTransportBackend({ @@ -261,8 +260,21 @@ export default class JitsiMeetExternalAPI extends EventEmitter { * @returns {Array} */ _getAlwaysOnTopResources() { + const iframeWindow = this._frame.contentWindow; + const iframeDocument = iframeWindow.document; + let baseURL = ''; + const base = iframeDocument.querySelector('base'); + + if (base && base.href) { + baseURL = base.href; + } else { + const { protocol, host } = iframeWindow.location; + + baseURL = `${protocol}//${host}`; + } + return ALWAYS_ON_TOP_FILENAMES.map( - filename => this._baseUrl + filename + filename => (new URL(filename, baseURL)).href ); }