Node Webkit - Open another hosted C2 game?

0 favourites
  • 5 posts
From the Asset Store
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • I noticed that Node Webkit won't open another C2 game as a separate window (in node webkit, not the browser).

    • Only happens for hosted C2 games.

    Does anyone know why?

  • I've narrowed it down to this: Uncaught ReferenceError: require is not defined

    		if (this.isNodeWebkit)
    		{
    			window["ondragover"] = function(e) { e.preventDefault(); return false; };
    			window["ondrop"] = function(e) { e.preventDefault(); return false; };
    			require("nw.gui")["App"]["clearCache"]();
    		}[/code:15dvhsxd]
  • There are multiple ways you can create a window in node-webkit, because of security concerns (enabling newly open window access to require enables them access to multiple dangerous settings.) You are probably using the window.open from browser object?

    Probably the newly open window has the 'node-enabled' set to false, to disable access to the node (more accurate, none of the parameters passed, so probably node is disabled by default, thus required not defined).

    You can pass all of the parameters of the manifest format to the new windows:

    var win = gui.Window.open('https://github.com', {
      position: 'center',
      width: 901,
      height: 127
    });[/code:31thx1i5]
    
    but mind that we're not doing the window.open, but rather gui.window.open.
    
    I have managed to get multiple c2 projects together in a nw app, but i packed it manually, had custom manifest file, used custom plugin for opening new windows, and it was long time ago. 
    
    I would recommend to dive in [url=https://github.com/rogerwang/node-webkit/wiki/Window]window[/url] and [url=https://github.com/rogerwang/node-webkit/wiki/Security]security[/url] and [url=https://github.com/rogerwang/node-webkit/wiki/Manifest-format]manifest[/url] parts of the wiki for starters.
    
    edit: sorry, i've written first, then opened your capx second -> i do not get any errors!
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You're able to play the game when the window opens? (the capx)

  • I updated to the latest beta and it works again (hate doing that).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)