Created
January 1, 2020 14:03
-
-
Save joe-oli/ff85d19c36d7ca1528ac6b64154eb4b2 to your computer and use it in GitHub Desktop.
open urls in browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/sindresorhus/open/issues/89 | |
Simple example. the array contains 3 urls; | |
It iterates thru, logs the urls correctly but only the first url is opened. | |
urlsArray.forEach(function(urlLine){ | |
opn(urlLine); //for each url... launch in Browser | |
console.log(urlLine); | |
}); | |
My environment is Windows / default Browser chrome | |
Node v 6.11.5 | |
//Author: joe-oli commented on Mar 23, 2018 | |
work around - | |
opn does not do what i want, use an o/s cmd instead. | |
var childProc = require('child_process'); | |
urlsArray.forEach(function(urlLine){ | |
var cmd = "start chrome " + urlLine | |
childProc.execSync(cmd); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment