Search code examples
javascripthtmlbrowserserver-sidehtml-rendering

server side browser


I was wondering if it is possible to run a browser (specifically a browser engine) on the server side. I do not just mean to render a page but to keep a browser open for some time, run some JS, do some clicks or press some keys and meanwhile grab the graphical output.

Does anyone know how to accomplish this? So far my only idea was to run the browser in a VNC, RDP etc. session but this seems like an overkill to me.


Solution

  • PhantomJS does what you are describing. It is basically a headless browser - http://phantomjs.org/

    you can run it server side via any server side language. See some integration modules below for NodeJS and PHP

    NodeJS

    https://npmjs.org/package/node-phantom

    https://github.com/sgentle/phantomjs-node

    PHP

    https://github.com/diggin/php-PhantomjsRunner