node.js 浏览器打开某个网址
2019-06-28 本文已影响0人
凡凡的小web
let child_process = require('child_process'),
url = 'http://' + youUrl;
if (process.platform == 'wind32') {
cmd = 'start "%ProgramFiles%\Internet Explorer\iexplore.exe"';
} else if (process.platform == 'linux') {
cmd = 'xdg-open';
} else if (process.platform == 'darwin') {
cmd = 'open';
}
child_process.exec(`${cmd} "${url}"`);
https://segmentfault.com/q/1010000005034484
https://blog.csdn.net/sleepwalker_1992/article/details/83783234