Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server side browser that can execute JavaScript

Is there any programming libraries available that will parse an HTML document, execute JavaScript and then allow me to navigate the DOM?  This needs to be performed server side, not client side. Any language will do, but Java, PHP, or Ruby are preferred.

like image 557
Matt Sidesinger Avatar asked Jan 26 '10 20:01

Matt Sidesinger


People also ask

Can I run JavaScript on server-side?

Node. js is a runtime environment to allow JavaScript to not only be run in the browser, but also on the server (or almost any environment, really). That also expanded the types of applications that could be built with the language since it wasn't tied to only the client-side anymore.

Does JavaScript run on server or browser?

JavaScript. JavaScript is a client-side script, meaning the browser processes the code instead of the web server. Client-side scripts are commonly used when we want to validate data before sending it to the web server, adjusting the interface in response to user feedback, and for implementing other advanced features.


3 Answers

Have you tried Bringing the Browser to the Server?

like image 112
Luca Matteis Avatar answered Oct 20 '22 16:10

Luca Matteis


in java: http://lobobrowser.org/cobra/java-html-parser.jsp
this is a a Javascript-aware, CSS-aware HTML parser
the most important feature in relation to your question: It is Javascript-aware. DOM modifications that occur during parsing will be reflected in the resulting DOM.

like image 2
Stefan De Boey Avatar answered Oct 20 '22 15:10

Stefan De Boey


Java has support for javascript with Rhino, also look at this page for server side javascript solutions: http://en.wikipedia.org/wiki/Server-side_JavaScript

like image 2
Pepijn Avatar answered Oct 20 '22 17:10

Pepijn