Manage browser history and URLs for proper navigation behavior with html★.

Push vs Replace

html★ provides two ways to update the browser URL:

AttributeHistory EffectBack Button
data-pushAdds new entryReturns to previous
data-replaceReplaces current entrySkips this page
(neither)No URL changeN/A

When to Use Each

data-push (Navigation)

Use for navigation between pages:

data-replace (Filters/Pagination)

Use when you don't want cluttered history:

No URL Change (Inline Updates)

Use when the update doesn't represent a new "page":

Back/Forward Navigation

html★ handles browser back/forward buttons by reloading the page. This ensures the correct state is shown without complex state management.

Why reload? html★ prioritizes simplicity over complexity. Rather than maintaining a JavaScript-based history stack, it lets the browser do what it does best — navigate to URLs.

Bookmarkable URLs

Because html★ uses real URLs, all your pages are bookmarkable and shareable. If someone shares a URL, they get the same page.

Example: SPA Navigation

This gives you:

  • ✓ SPA-like navigation (no full page reload)
  • ✓ Working back/forward buttons
  • ✓ Bookmarkable URLs
  • ✓ Works without JavaScript (graceful degradation)

Inheritance

Both data-push and data-replace inherit from ancestors: