【问题标题】:CrossStorageClient could not connect in IE 11CrossStorageClient 无法在 IE 11 中连接
【发布时间】:2020-03-08 17:02:12
【问题描述】:

我正在使用 Windows 和适用于 Linux 的 Windows 子系统在我的机器上调试网站。

我在我的网站中使用cross-storage。我可以在 Chrome 下启动网站https://localhost:3000/sign,而在 IE 中会引发错误CrossStorageClient could not connect,从而阻止页面。

Chrome 中没有错误:

CrossStorageClient could not connect 在 IE 中

在客户端,似乎是new CrossStorageClient(...) 引发了错误。

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

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

如果我在 IE 的标签页中打开https://localhost:3000/htmls/hub.html,它会显示security certificate 的问题,我可以点击Go on to the webpage (not recommended) 继续。 (无论如何,客户端的CrossStorageClient could not connect 错误仍然会引发)。

这里是服务器端的hub.html

<!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>

那么,有谁知道如何解决这个CrossStorageClient could not connect 错误?

除了CrossStorageClient还有其他选择吗?

【问题讨论】:

标签: localhost ssl-certificate local-storage virtual-machine cross-domain


【解决方案1】:

我认为这与超时配置有关。改成30000再测试一下(如果不行,试试加大数字)

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-21
  • 1970-01-01
  • 2020-06-05
  • 1970-01-01
  • 1970-01-01
  • 2017-04-17
相关资源
最近更新 更多