美文网首页
node.js 浏览器打开某个网址

node.js 浏览器打开某个网址

作者: 凡凡的小web | 来源:发表于2019-06-28 10:05 被阅读0次
    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

    相关文章

      网友评论

          本文标题:node.js 浏览器打开某个网址

          本文链接:https://www.haomeiwen.com/subject/stzjcctx.html