A router for the browser (client-side JavaScript)

npm install navigate
1 downloads in the last day
1 downloads in the last week
29 downloads in the last month


Description: A router for the browser (client-side JavaScript).

Home page:

Demo page:

Git repository url: git://

npm package: navigate

jam package: navigate

License: MIT

Author: Vytautas Jakutis


  • has no dependencies
  • supports Asynchronous Module Loader (AMD, RequireJS), CommonJS (Node.js require) and regular <script> loading
  • if HTML5 History API is not available, falls back to hashes
  • handles click events on same origin links
  • supports browsers:
    • Mozilla Firefox 1.0+
    • Opera 8.00+
    • Google Chrome 1+
    • Microsoft Internet Explorer 6+
    • Apple Safari 3.0+

API Reference

// configure, can be called anytime at all (including never)
    // whether same origin a.href clicks are captured
    clickHandlingEnabled : true,
    // URL path prefix
    basePath : ''

// initialize

// get current page (also initialize, if not initialized)
navigate(function(entryPage) {
    console.log('Entry page to this web app is ' + entryPage);

// handle navigations to /user/* pages
navigate(/^\/user\/(.+)$/, function(args, from, to) {
    console.log('Navigated from page ' + from + ' to ' + to);
    console.log('Showing user ' + args[0]);

// navigate to user's "tahu" page
npm loves you