Skip to content

Instantly share code, notes, and snippets.

@Jonathan-Dobson
Created November 23, 2021 15:13
Show Gist options
  • Save Jonathan-Dobson/69e4589dbffd4c9e6a270c337b2d8e58 to your computer and use it in GitHub Desktop.
Save Jonathan-Dobson/69e4589dbffd4c9e6a270c337b2d8e58 to your computer and use it in GitHub Desktop.
Open browser from node script
#!/usr/bin/env node
const url = 'http://localhost'
require('child_process')
.exec((process.platform
.replace('darwin','')
.replace(/win32|linux/,'xdg-') + 'open ' + url));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment