WebJs Gallery

Client router

Navigate to the second page and back. With JS on it is a soft swap (no full reload, scroll restored); open the network tab to see only a fragment fetched, prefetched on hover. With JS off the same links do full-page navigations. Nothing was imported to get this.

Rendered on the server at 15:11:19 UTC. This page function runs only on the server, so this stamp changes on every render, which is what makes refreshPage() below visible.

Or drive it from JS with navigate() / revalidate() / refreshPage():

refreshPage() re-renders THIS url on the server and swaps it in. The server time above updates, and your scroll position does not move. On a page with hydrated components outside the swapped region, their state survives too.

Plain link: /features/client-router/second. The router is on, so this soft-navigates (no full reload). Toggle it off, then click again to watch the browser do a full page load.

Opt out app-wide with { "webjs": { "clientRouter": false } }, or per-link with data-no-router (use it for auth flows like /logout that must reset in-memory state). A forward navigation scrolls to top; per link (or per wrapping element) data-preserve-scroll keeps the reader where they are, for a filter or tab link that changes only part of what they are looking at. A hash link still scrolls to its anchor, and a frame-targeted link never scrolled anyway.