PJAX

The advanced PJAX superior to SPA.

Features

The pjax-api provides almost complete original web experience.

Modes

Adding JSON APIs is the only change required on servers to enable SPA on Pjax.

JSON(SPA) mode is statically and dynamically configurable per URL scope on browsers.

Usage

<script src="https://cdn.jsdelivr.net/npm/pjax-api@latest"></script>
<script src="/assets/js/config.js"></script>
// config.js
import Pjax from 'pjax-api';
// or
const { Pjax } = window['pjax-api'];

new Pjax({
  areas: [
    // Try the first query.
    '#header, #primary',
    // Retry using the second query
    // if the first query doesn't match.
    '#container',
    // Retry.
    'body'
  ]
});

Documents

This site is also powered by PJAX as a demo. Try page transitions.

Browsers

  • Chrome
  • Firefox
  • Safari
  • Edge (Chromium edition only)