zoukankan      html  css  js  c++  java
  • 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     ]
  • 相关阅读:
    java File获取字节流
    mybatis返回自增主键问题踩坑
    电脑右键没有新建选项解决
    mysql 索引
    高并发-原子性-AtomicInteger
    Cannot find the declaration of element 'ehcache'.
    CSRF拦截
    java责任链模式
    java实现一个简单的计数器
    Java并发编程
  • 原文地址:https://www.cnblogs.com/PengRay0221/p/10429350.html
Copyright © 2011-2022 走看看