javascript - 使用 Node.js 以编程方式启动和终止 Web 浏览器

标签 javascript node.js browser

如何使用 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
});

最佳答案

关于javascript - 使用 Node.js 以编程方式启动和终止 Web 浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30646859/

相关文章:

javascript - 如何根据样式值选择元素?

node.js - Electron 中的自签名证书

node.js - Gmail 阻止 Nodemailer 发送邮件

javascript - 拦截浏览器慢脚本消息

javascript - 是否定义了跨操作系统 sleep /暂停的 setTimeout 行为?

javascript - 如何延迟javascript中元素的onclick响应

javascript - Angular 和 rails

javascript - 如何在 PHP Laravel 中使用 SQL 语句打印所有数组?

node.js - 在 node.js 中创建 S3 签名 URL

javascript - 是否有内置的 Javascript 函数可以将一个月的文本字符串转换为等效的数字?