zendesk / cross-storage

Cross domain local storage, with permissions
Apache License 2.0
2.22k stars 180 forks source link

CrossStorageClient could not connect in IE 11 #56

Open chengtie opened 4 years ago

chengtie commented 4 years ago

I'm debugging a website on my machine with Windows and Windows Subsystem for Linux.

I use cross-storage in my website. I can launch the website https://localhost:3000/sign under Chrome, whereas in IE it raises an error CrossStorageClient could not connect, which blocks the page.

No error in Chrome: enter image description here

CrossStorageClient could not connect in IE enter image description here

In the client side, it seems that it is new CrossStorageClient(...) that raises the error.

const storage = new CrossStorageClient(`https://localhost:3000/htmls/hub.html`, {}); 

export async function getSignToken() {
  await storage.onConnect();

If I open https://localhost:3000/htmls/hub.html in IE in a tab, it shows a problem of security certificate, I could click on Go on to the webpage (not recommended) to continue. (The CrossStorageClient could not connect error of the client side is still raised regardless of this). enter image description here

Here is hub.html on the server side:

<!doctype html>
<head>
  <title>Production Cross Storage Hub</title>
</head>
<body>
  <script type="text/javascript" src="/javascripts/hub.js"></script>
  <script>
    CrossStorageHub.init([
        {origin: /:\/\/localhost(:[0-9]*)?$/, allow: ['get', 'set', 'del']},
        {origin: /\.10studio.tech$/, allow: ['get', 'set', 'del']},
        {origin: /:\/\/(www\.)?10studio.tech$/, allow: ['get', 'set', 'del']}
    ]);
  </script>
</body>
</html>

So, does anyone know how to fix this CrossStorageClient could not connect error?

gwdp commented 3 years ago

@chengtie I had a similar issue (except the DLG_FLAG problem), And was able to fix it by increasing the timeout for 15/20 seconds because everything is slower on IE :/ (Hub probably not fully initialized yet on default timeout?)

Hope it helps you or someone digging into it.