【问题标题】:NodeWebkit (nw.js) allow self signed SSL certificate inside iframeNodeWebkit (nw.js) 允许在 iframe 中使用自签名 SSL 证书
【发布时间】:2015-07-02 00:31:16
【问题描述】:

我有一个带有这个 package.json 的 nw.js 应用程序:

{
  "main": "index.html",
  "name": "test_app",
  "window": {
    "toolbar": false,
    "position": "center",
    "min_width": 800,
    "min_height": 500,
    "as_desktop": true,
    "resizable": true,
    "frame": true,
    "chromium-args": "--ignore-certificate-errors"
  },
  "webkit": {
    "plugin": true,
    "page-cache": true
  }
}

我的 index.html 包含以下代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>demo</title>
</head>
<body>
<iframe src="https://www.example.com"></iframe> 
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>
    function myfunc(){
        alert("my func");
    }
</script>
</body>
</html>

问题:

我的网站(iframe 的源代码)https://www.example.com 有一个自签名证书,所以如果我尝试在控制台中加载,给我这个错误:

Failed to load resource: net::ERR_INSECURE_RESPONSE  

为什么--ignore-certificate-errors 不在 iframe 子级中扩展?

提前致谢!

【问题讨论】:

    标签: node-webkit nw.js


    【解决方案1】:

    我在nw.js github repo 上的一个问题中找到了解决方案。

    基本上你需要使用:

      "chromium-args": "--allow-running-insecure-content --ignore-certificate-errors",
    

    而且它必须在package.json 文件中的窗口对象之外(例如在name 属性之后)。

    【讨论】:

      猜你喜欢
      • 2017-12-19
      • 1970-01-01
      • 1970-01-01
      • 2020-10-25
      • 2020-05-22
      • 2017-06-13
      • 2015-05-08
      • 2012-11-01
      • 1970-01-01
      相关资源
      最近更新 更多