gpt4 book ai didi

node-webkit - NodeWebkit (nw.js) 允许在 iframe 中使用自签名 SSL 证书

转载 作者:行者123 更新时间:2023-12-01 14:20:40 27 4
gpt4 key购买 nike

我有一个带有这个 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 的 src)https://www.example.com有一个自签名证书,所以如果我尝试在控制台中加载,请给我这个错误:

Failed to load resource: net::ERR_INSECURE_RESPONSE  

为什么 --ignore-certificate-errors 没有在 iframe child 中扩展?

提前致谢!

最佳答案

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

基本上你需要使用:

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

并且它必须位于 package.json 文件中的 window 对象之外(例如在 name 属性之后)。

关于node-webkit - NodeWebkit (nw.js) 允许在 iframe 中使用自签名 SSL 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29829935/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com