Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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');
like image 946
Max Markson Avatar asked Mar 28 '26 22:03

Max Markson


1 Answers

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
like image 77
Marco Tolk Avatar answered Apr 01 '26 07:04

Marco Tolk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!