NodeJS module for WebKit
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1880 commits behind nwjs:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a NodeJS module for WebKit. With this module, your Javascript code in HTML can call NodeJS functions directly:

var fs = require('fs');

function test_fs() {
  var output = document.getElementById ('output');
  output.innerHTML = '';
  fs.readdir(".", function (err, files) {
    var result = '';
    files.forEach(function (filename) { result += filename + '<br/>'; } );
    output.innerHTML = result;
<body onload="test_fs()">
<p id="output"></p>

From NodeJS code, you can manipulate DOM or run Javascript in DOM context as well:

var nwebkit;
nwebkit = require('nwebkit');

nwebkit.init ({'url' : "tests/testfs.html"},
      function() {


A patched version of WebKit (libwebkitnode) is need to make this possible. Prebuilt binaries for Debian and Ubuntu can be downloaded from:

deb dist/

where "dist" can be "unstable" for Debian sid, or "natty", "oneiric" for Ubuntu.

NOTE: currently there is only 32bit binaries available.

The source of libwebkitnode is provided in patches directory. We hope git repo will be available soon.


  • The following package is needed to build this:

    nodejs-dev libwebkitnode-dev libev-dev

  • Build:

    node-waf configure build

  • Run sample:

    node tests/helloworld.js tests/testfs.html

How it works

  • WebKitGtk's (glib based) main loop is merged with libev's main loop in NodeJS (Thanks to the code from node-gtk and EV::Glib project), so they can run in the same process.

  • WebKit is patched so we can switch the Javascript engine from jsc to V8, and then the V8 context is merged (actually bridged) with the context from NodeJS. This makes NodeJS functions accessiable in web page. (Thanks to Nayan Kumar for the webkit-v8 work)


Welcome to join the discussion in our mailing list:

subscribe via

Our vision

We believe that the async I/O framework in NodeJS and the Javascript programming language is a perfect combination for client (mobile) side applications. By bringing WebKit to NodeJS, a new way is avaliable to write applications with web technology. We'll contintue our development and support for this runtime. More platform and applications will be enabled.


MIT License