nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

nw.Window.open cannot open html file in the project

Open LxeC opened this issue 2 years ago • 0 comments

Putting a popup.html file in my www/views/ project folder and calling the example provided by the Docs:

nw.Window.open('views/popup.html', {}, function (win) {
  // Release the 'win' object here after the new window is closed.
  win.on('closed', function () {
    win = null;
  });

  // Listen to main window's close event
  nw.Window.get().on('close', function () {
    // Hide the window to give user the feeling of closing immediately
    this.hide();

    // If the new window is still open then close it.
    if (win !== null) {
      win.close(true);
    }

    // After closing the new window, close the main window.
    this.close(true);
  });
});

opens a window without the html file loaded. I tried with 'views/popup.html', './views/popup.html' and putting the file at the root of www I cannot really find how to load an html from the project folder anywhere. The docs do not help with this.

This was not an issue a view versions back.

  • [x] Bug Report
  • [x] Successfully reproduced against the latest version of NW.js?
  • Operating System: Windows 11
  • NW.js Version: 0.78.0

LxeC avatar Jul 29 '23 16:07 LxeC