【问题标题】:Launching Chrome without web-securities in VS Code在 VS Code 中启动没有网络安全的 Chrome
【发布时间】:2017-11-09 00:09:16
【问题描述】:

如何在 VS Code 的 launch.json 文件中配置没有网络安全的 Chrome 浏览器?我安装了 VS Code 扩展 Debugger for Chrome,我的 launch.json 看起来是这样的:

{
  "version": "0.2.0",
  "configurations": [

    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome",
      "url": "http://localhost:8100/",
      "webRoot": "${workspaceRoot}"
    }
  ]
}

此代码启动具有网络安全功能的 Chrome。如何配置此文件以便我可以使用此参数启动 Chrome:chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security

【问题讨论】:

    标签: visual-studio-code vscode-extensions vscode-settings


    【解决方案1】:

    只需添加

    "runtimeArgs": [
       "--disable-web-security"
    ],
    

    所以你的 launch.json 看起来像:

    {
      "version": "0.2.0",
      "configurations": [
    
        {
          "type": "chrome",
          "request": "launch",
          "name": "Launch Chrome",
          "url": "http://localhost:8100/",
          "runtimeArgs": [
             "--disable-web-security"
           ],
          "webRoot": "${workspaceRoot}"
        }
      ]
    }
    

    【讨论】:

    • 这在 Windows 机器 "runtimeArgs": ["--disable-web-security","--user-data-dir=c:\\chrome-browser"] 上对我有用。
    猜你喜欢
    • 2016-01-11
    • 2014-06-16
    • 2019-06-21
    • 1970-01-01
    • 2015-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    相关资源
    最近更新 更多