On this page
Navigate between pages
Add smooth navigation and a page loading view.
Before you begin: Initialize frontbacked.js.
FQL Lifecycle
When initialized, frontbacked.js reads the page's state declaration, binds the declared DOM events, loads the settings, posts, lists, and account values the page asks for, then renders matching f-* elements. When state changes, derived values and bound DOM elements update again.
State keys ending in .live continue to follow saved data changes after the first render. Frontbacked keeps one live connection for the page, refreshes affected selections through the same FRL permissions, recomputes dependent state, and updates the DOM.
For conditional visibility, f-hide elements stay visible until their expression resolves truthy, while f-show elements are hidden as soon as Frontbacked starts and stay hidden until their expression resolves truthy. This makes f-show the safer choice for links or panels that must not flash before auth or requested data is known.
Frontbacked also handles smooth same-site page navigation. When a visitor clicks an internal link, frontbacked.js loads the next HTML page, applies the new page, re-runs FQL, and updates browser history without a full reload.
Add a custom loading view with f-loader:
Frontbacked waits for the next page's new stylesheets before swapping the body, so visitors do not see the next page before its CSS is ready. It also prefetches same-site links on hover, focus, and touch start so navigation feels quick.
Use f-nav="reload" when a link or whole page should keep normal browser reload behavior:
Programmatic navigation is available through Frontbacked.navigate("/packages"). New pages open at the top without a scrolling animation, including browser back/forward navigation. Refreshing the current page restores its previous scroll position after its content loads. Links to anchors within the current page still scroll to that section. By default, programmatic navigation pushes history and scrolls to the top. Use { history: "replace" } for redirects, { scroll: "preserve" } when the current scroll should stay in place, and { minLoadTime: 1000 } when you want to preview a loader for at least one second.
The same minimum loading time can be declared in HTML:
Continue with Reuse page components.