Quellcode durchsuchen

fix(local-storage) use local storage on WebKit when not in an iframe

There should be no need to use the workaround when visiting the site normally.
master
Saúl Ibarra Corretgé vor 4 Jahren
Ursprung
Commit
11382cfda6
1 geänderte Dateien mit 17 neuen und 1 gelöschten Zeilen
  1. 17
    1
      react/features/base/jitsi-local-storage/setup.web.js

+ 17
- 1
react/features/base/jitsi-local-storage/setup.web.js Datei anzeigen

@@ -11,6 +11,20 @@ import logger from './logger';
11 11
 declare var APP: Object;
12 12
 declare var config: Object;
13 13
 
14
+/**
15
+ * Checks whether we are loaded in an iframe.
16
+ *
17
+ * @returns {boolean} Returns {@code true} if loaded in iframe.
18
+ * @private
19
+ */
20
+ function _inIframe() {
21
+    try {
22
+        return window.self !== window.top;
23
+    } catch (e) {
24
+        return true;
25
+    }
26
+}
27
+
14 28
 /**
15 29
  * Handles changes of the fake local storage.
16 30
  *
@@ -41,7 +55,9 @@ function shouldUseHostPageLocalStorage(urlParams) {
41 55
         return true;
42 56
     }
43 57
 
44
-    if (browser.isWebKitBased()) { // Webkit browsers don't persist local storage for third-party iframes.
58
+    if (browser.isWebKitBased() && _inIframe()) {
59
+        // WebKit browsers don't persist local storage for third-party iframes.
60
+
45 61
         return true;
46 62
     }
47 63
 

Laden…
Abbrechen
Speichern