Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.

  工具环境:Layui 框架下使用VS Code进行Chrome 调试。

  问题描述:当Chrome浏览器使用iframe页面调用其他页面时会提示:"Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame"。

      但是IE和Edge是没有问题的。

  原因:Chrome 认为其跨域不安全。

  解决办法:launch.json里面加上配置:

      ,"runtimeArgs": [
        " --disable-web-security"
      ]
  完整配置文件如下:
 1    "version": "0.2.0",
 2     "configurations": [
 3         {
 4             "name": "使用本机 Chrome 调试",
 5             "type": "chrome",
 6             "request": "launch",
 7             "file": "${workspaceRoot}/index.html",
 8             //"url": "http://mysite.com/index.html", //使用外部服务器时,请注释掉 file, 改用 url, 并将 useBuildInServer 设置为 false "http://mysite.com/index.html
 9             "runtimeExecutable": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", // 改成您的 Chrome 安装路径
10             "sourceMaps": false,
11             "webRoot": "${workspaceRoot}",
12         //  "preLaunchTask":"build",
13             "userDataDir":"${tmpdir}",
14             "port":5433
15             ,"runtimeArgs": [  
16                 " --disable-web-security"   //跨域访问,不安全,仅本地测试
17             ]
18         }
19     ]

 

转载于:https://www.cnblogs.com/PengRay0221/p/10429350.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值