Max Markson
Max Markson

Reputation: 800

Node.js open chrome in full screen

I have to open google chrome to a specific page after the server, written in Node.js, is ready. To do this I've used this code:

var open = require("../lib/node_modules/open");
open("localhost:4000", "chrome");

I know that exist the kiosk mode but

open("localhost:4000", "chrome --kiosk");

doesn't work.

How can I launch chrome in full screen from the Node.js server?


SOLUTION

Close all other instances of chrome and use

var childProcess = require('child_process'); 
childProcess.exec('start chrome --kiosk localhost:4000');

Upvotes: 3

Views: 7998

Answers (1)

Marco Tolk
Marco Tolk

Reputation: 832

I've had a quick look at the source code for open, specifically lines 31, 40 and 47. There you can see that the appname, your second parameter "chrome --kiosk" is escaped, which will result in "chrome%20--kiosk". This makes it impossible to add parameters to the appname when using open.

So your options are to:

  • either fork open and add the functionality to add parameters to open
  • use child_process.exec yourself in a similar fashion as open so you can prevent the escaping

Upvotes: 2

Related Questions