fix(alwaysontop): URLs for the additionally loaded resources.

This commit is contained in:
hristoterezov 2017-11-13 16:29:38 -06:00 committed by Дамян Минков
parent aec22b8ed9
commit eb30ea9693
1 changed files with 14 additions and 2 deletions

View File

@ -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<string>}
*/
_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
);
}