3 ms·
As a side note, is there a way to run this thing standalone as a headless browser?
by elorant 10y ago
As a side note, is there a way to run this thing standalone as a headless browser?
- pritambaral 10y agoV8 is not a browser. It's just a JavaScript engine. For a browser, you'd need a rendering engine and some networking code. For a list of headless browsers, see [0]. Not all entries in that list run v8. [0]: https://github.com/dhamaniasad/HeadlessBrowsers https://github.com/dhamaniasad/HeadlessBrowsers
- elorant 10y agoYes I know that, but what if all you want is just to execute the JavaScript on a page?
- rpeden 10y agoThe catch is that usually, the JavaScript is on a page because it interacts with the page in some way. So without a DOM, executing the page's JS likely won't work. Having said that: if you just want a headless V8 VM, Node.js is what you're looking for. You can even use jsdom there to simulate a web page if the JS you're trying to run requires it. If you're looking for headless Chrome/Chromium (which includes V8), try nightmareJS. Neither Node nor nightmare include V8 5.4, but they will in the relatively near future.
- zeroxfe 10y agoV8 is just the JavaScript runtime, not a full browser environment (i.e., no DOM, etc.) If you want to use V8 headless, you can either use NodeJS or you can link it into your own C/C++ code to run JS scripts, which is what I did a while ago for a project that needed a scripting hook. If you want to run a full browser environment headlessly, take a look at PhanthomJS or SlimerJS, or use one of the fake DOM thingies for Node.