今天,在 react 项目中使用 iframe,测试 百度网页OK,但使用生产实际的 URL,出现如下报错:

iframe: 报错 DOMException: Failed to read the 'localStorage' property from 'Window':

报错内容:Failed to read the 'localStorage' property from 'Window' : Access is denied for this document.

问题场景:
在Iframe 中引入720全景网页是报错。


解决办法:
Under Chrome's Settings > Privacy > Content settings, you have the cookie setting set to to "Block sites from setting any data"

即:

在Chrome设置菜单中: 高级 > 隐私设置和安全性 > 内容设置 > Cookie > 阻止第三方Cookie

将这项关闭,如下图
iframe: 报错 DOMException: Failed to read the 'localStorage' property from 'Window':

 

 

 

相关文章:

  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案