如何使用 Node.js 以编程方式启动和终止 Web 浏览器?
像这样的伪代码:
var spawn = require('child_process').spawn;
// This opens a browser and returns control to terminal, but optimally
// the process should run in the foreground and exit on ctrl-c.
spawn('open', ['http://www.stackoverflow.com']);
process.on('SIGINT', function() {
// Kill the opened browser here
});
最佳答案
您可以使用“生成”
https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
另外,引用:https://stackoverflow.com/a/16099450/4130451
杀死:https://nodejs.org/api/child_process.html#child_process_child_kill_signal
关于javascript - 使用 Node.js 以编程方式启动和终止 Web 浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30646859/