2015-04-23 64 views
3

自签名证书我有这样的package.json一个nw.js应用:NodeWebkit(nw.js)允许里面的iframe

{ 
    "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子里面?

在此先感谢!

回答

2

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

基本上你需要使用:

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

而且它在package.json文件(例如后财产name)window对象之外去。