This project is not covered by Drupal’s security advisory policy.

pjax is a jQuery plugin that loads new content into the current page without a full page load. This is usually quicker and smoother than a full page reload, because Drupal only has to deliver the main page content and not the full page – and the browser only has to redraw a smaller amount of markup.

In addition to this, pjax updates the page URL with the proper page path using HTML5 pushState – not with #url-fragments that are commonly used with ajax-loaded content. It also updates the page title with the title of the loaded page. In other words, it has all of the benefits of standard page loads (permalinks, SEO), while taking advantage of partial page loads in the browser.

Browsers that don't support pushState – specifically IE < 10 – will automatically fall back to full page loads. In other words, nothing will break, but the module will not provide any benefits for those browsers.

For a quick example of this technique, see the original pjax demo. A more elaborate example is Github's project file browser.

Note: this module is currently incompatible with recent versions of Pjax. See #1846300: Bad function call in pjax.js

Details

pjax for Drupal works best when you use it to load pages that are fairly simple in themselves, but have lots of side content that does not change between pages. A good example of this is a paged view, where you use pjax on the pager links.

Any side content, such as menus, sidebars and footers, will remain unchanged when the new pages load – which usually makes it less optimal to use pjax on a main menu where you are jumping between different sections of a site. Another potential problem is that JavaScript and CSS that Drupal includes on a page-by-page basis will not be added consistently. These are issues that are possible for site builders to overcome, but the module does not attempt to solve them.

The module defines its own page delivery mechanism for pjax requests. The requests are cached by the standard page cache – just like ordinary page loads.

Installation and usage

This module requires the Libraries module the pjax library.

Recent versions of pjax also requires jQuery 1.7 or higher, which means you have to install and configure the jQuery Update module.

More instructions can be found in the README.

Credits

jquery.pjax by Chris Wanstrath: https://github.com/defunkt/jquery-pjax
Drupal module developed by Hannes Lilljequist at SthlmConnection

Project information

  • caution Seeking co-maintainer(s)
    Maintainers are looking for help reviewing issues.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • chart icon20 sites report using this module
  • Created by zoo33 on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases