PhantomJS 1.4 Release Notes

PhantomJS 1.4, Glory of the Snow, was released on December 22, 2011. It is a minor update, mostly bug fixes and one new major feature: WebServer module.

This version is backward compatible with version 1.3. Existing scripts should work without any modification.

Minimum requirement to build PhantomJS 1.3 is Qt 4.6 or later. Latest stable release of Qt, i.e. version 4.8.0, is strongly recommended.

WebServer module

Note: This WebServer module is intended for ease of communication between PhantomJS scripts and the outside world. It is not recommended to use it as a general production server.

By using the embedded web server module Mongoose, PhantomJS script can start a web server which listens to a particular port.

A very simple example is as follows. It always gives the same response for any request.

var server = require('webserver').create();
var service = server.listen(8080, function (request, response) {
    response.statusCode = 200;

The request object passed to the callback function may contain the following properties:

The response object should be used to create the response:

This WebServer module is still rather simple in this version. Depending on the needs, the functionalities and the corresponding API will be expanded in the next versions.

Static version build script

For continuous integration server and various other uses cases, often it is desired to have a static version of PhantomJS which has almost zero dependencies. While building PhantomJS for the static build is not difficult, it is often a daunting task to figure out the bits and pieces necessary to achieve that build.

For convenience, now there are two build scripts, available in the deploy subdirectories, each for Linux and Mac. The script automatically downloads the source code of Qt, build everything locally, and then prepare the binary for deployment. There is no need to have Qt installed on the system before running the script.

The produced binary has very minimal dependencies and can be transferred to another machine easily. With the help of UPX (optional), the size of the binary is only about 10 MB.

Note: Even with the static build, as of now you still need to setup Xvfb for the Linux version. Also for Mac, don’t forget the Info.plist file (see issue 281).

New features

Bug fixes


Back to all releases.