NodeWebkit (nw.js) allows self-signed SSL certificate inside iframe

I have an nw.js application with this package. json:

{
  "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
  }
}

      

My index.html includes this code:

<!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>

      

Problem:

My site (src of iframe) https://www.example.com has its own certificate, so if I try to load in the console give me this error

Failed to load resource: net::ERR_INSECURE_RESPONSE  

      

Why is --ignore-certificate-errors

n't it propagated inside the iframe child?

Thanks in advance!

+3


source to share


1 answer


I found a solution in one of the nw.js github repo issues .

Basically you need to use:



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

      

And it must go outside the window object (like after a property name

) in the file package.json

.

+2


source







All Articles