Newer Version Available

This content describes an older version of this product. View Latest

URL-Centric Navigation

It's useful to understand how the framework handles page requests. The initial GET request for an app retrieves a template containing all the framework JavaScript and a skeletal HTML response. All subsequent changes to everything after the # in the URL trigger an XMLHttpRequest (XHR) request for the content. The client service makes the request, and returns the result to the browser.

The portion of the URL before the # value doesn't change after the initial app request. The app is long-lived with subsequent actions causing incremental changes to the DOM for the lifetime of the app.

Navigation Events

The framework uses its event model to manage content change in response to URL changes. The framework monitors the location of the current window for changes. If the # value in a URL changes, the framework fires an application event of type aura:locationChange. The locationChange event has a single attribute called token.

For example, if the URL changes from /demo/test.app# to /demo/test.app#foo, a aura:locationChange event is fired, and the token attribute on that event is set to foo.