Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Never load a full page over and over again.

branch: master

bumped version

latest commit 86aa3b4a22
Vadim authored December 07, 2013
Octocat-spinner-32 build new build December 07, 2013
Octocat-spinner-32 src Improved code December 07, 2013
Octocat-spinner-32 .bowerrc Bower integration December 07, 2013
Octocat-spinner-32 .editorconfig added .editorconfig December 07, 2013
Octocat-spinner-32 .gitignore Bower integration December 07, 2013
Octocat-spinner-32 Gruntfile.js Bower integration December 07, 2013
Octocat-spinner-32 LICENSE-MIT init June 03, 2012
Octocat-spinner-32 README.md 2013 December 07, 2013
Octocat-spinner-32 bower.json bumped version December 07, 2013
Octocat-spinner-32 package.json bumped version December 07, 2013
README.md

Joconut

Never load a full page on every request again.

Getting Started

Download the production version or the development version.

Or, install Joconut via Bower:

bower install joconut

Include it in your web pages(1.3kb minified and gzipped):

<script src="joconut.min.js"></script> <!-- you must include jQuery before that -->

That's it! Now, all your local links will not cause page refresh. Remote links will work as expected.

Events

You can listen to some events Joconut can emit using on method:

$.joconut.on('error', function(err){ // fires on timeout, page without <body>, invalid requests
    alert('Error while loading new page!');
});

$.joconut.on('fetch', function(){ // Page changed
    alert('New page!');
});

$.joconut.on('before:fetch', function(){ // page will be loaded now
    alert('Before loading new page');
});

Extra

You can force Joconut to replace only part of the page by specifying selector of that part:

$.joconut.container = '#container'; // default is 'body'

Features

  • Detects and loads scripts and stylesheets from fetched pages, if they do not exist in the current one
  • HTML5 History API support with fallback to location.hash
  • Can replace only specific part of the page

How is it different from the existing PJAX plugin?

  1. Auto-detects and loads JS and CSS from fetched pages, if needed
  2. No need to set up or configure

Browser support

Joconut can work in browsers, which support HTML5 History API or hashchange event. For the list of supported browsers check out these links: pushstate and hashchange

License

Copyright (c) 2013 Vadim Demedes
Licensed under the MIT license.

Something went wrong with that request. Please try again.