瀏覽代碼

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

master
hristoterezov 7 年之前
父節點
當前提交
eb30ea9693
共有 1 個檔案被更改,包括 14 行新增2 行删除
  1. 14
    2
      modules/API/external/external_api.js

+ 14
- 2
modules/API/external/external_api.js 查看文件

215
             noSSL,
215
             noSSL,
216
             roomName
216
             roomName
217
         });
217
         });
218
-        this._baseUrl = `${noSSL ? 'http' : 'https'}://${domain}/`;
219
         this._createIFrame(height, width);
218
         this._createIFrame(height, width);
220
         this._transport = new Transport({
219
         this._transport = new Transport({
221
             backend: new PostMessageTransportBackend({
220
             backend: new PostMessageTransportBackend({
261
      * @returns {Array<string>}
260
      * @returns {Array<string>}
262
      */
261
      */
263
     _getAlwaysOnTopResources() {
262
     _getAlwaysOnTopResources() {
263
+        const iframeWindow = this._frame.contentWindow;
264
+        const iframeDocument = iframeWindow.document;
265
+        let baseURL = '';
266
+        const base = iframeDocument.querySelector('base');
267
+
268
+        if (base && base.href) {
269
+            baseURL = base.href;
270
+        } else {
271
+            const { protocol, host } = iframeWindow.location;
272
+
273
+            baseURL = `${protocol}//${host}`;
274
+        }
275
+
264
         return ALWAYS_ON_TOP_FILENAMES.map(
276
         return ALWAYS_ON_TOP_FILENAMES.map(
265
-            filename => this._baseUrl + filename
277
+            filename => (new URL(filename, baseURL)).href
266
         );
278
         );
267
     }
279
     }
268
 
280
 

Loading…
取消
儲存