Reputation: 281
Does PhantomJS work client side or server side? I know JavaScript can work client and server side, but I don't know which one PhantomJS is based on?
Upvotes: 1
Views: 1281
Reputation: 1878
PhantomJS is a headless browser. The PhantomJS API is used to control the browser itself, as well as allowing you to inject Javascript within the DOM context.
PhantomJS is a HTTP client.
You can put PhantomJS on a server to act as an automated client. In that way it you could consider it server side. But it is still a HTTP client at it's core.
The purpose of PhantomJS is instead of using a mouse and keyboard to control a browser and complete some actions, for instance: open a new window, type a url, enter, find a link and click it. You can automate those actions programmatically with Javascript.
If you are considering the conventional terminology meaning; code inside a loaded webpage being Client Side and code running on a HTTP Server being Server Side. Usually PhantomJS is Client Side that is run on Server Side.
Upvotes: 0
Reputation:
Is PhantomJS client side or server side?
Is it client-side?
Yes, if you mean, does PhantomJS emulate/replace the browser which we usually think of as "client-side"--that is its purpose in life!
No, if by "client-side", you mean "runs in a browser"--because PhantomJS itself is a browser (albeit with no visual display of the screen--hence the term "headless").
Is it server-side?
Yes, if by "server-side" you mean PhantomJS could run on some computer which I might think of as a server, including one off in the cloud somewhere.
No, if by "server-side" you mean PhantomJS implements, or would be used to implement, a web server handling HTTP calls and implementing some API.
Do you have some specific issue you were trying to solve, or is this just curiosity and clarification of terminology?
Upvotes: 6