Kim Honoridez
Kim Honoridez

Reputation: 997

window.maximize function is undefined

I wanted to open a new node webkit window and maximize it. However, I get undefined function for window.maximize() when I launch the new window.

Also other options for the new window are not working like frame and toolbar. What could have been the reason for this?

mainApp.js

function waitForConsoleThenStart() {
    if (typeof global.window !== 'undefined') {

        try {
            var myWin = global.window.open("http://www.google.com", {
                "frame": true,
                "toolbar": true,
                "transparent": false
            });

            console.log(myWin);

            myWin.on("loaded", function () {
                console.log("I am loaded.");
                myWin.maximize();
            });
        }
        catch(e) {

        }

        window.maximize();

    } else {
        setTimeout(waitForConsoleThenStart, 100);
    }
}
waitForConsoleThenStart();

This is how my manifest looks like:

package.json

{
  "name": "kissa-base",
  "main": "index.html",
  "node-main": "mainApp.js",
  "window": {
    "icon": "app/img/tpc-ohcis-logo-48x48.png",
    "toolbar": true,
    "frame": false,
    "transparent": true
  }
}

Upvotes: 0

Views: 180

Answers (1)

Nabeel Hassan
Nabeel Hassan

Reputation: 492

try this

 var gui = require('nw.gui');
 gui.Window.open("http://www.google.com",{"fullscreen":true});

I believe you are not opening a new nwjs window but a html window.

Upvotes: 1

Related Questions