WinJS.UI.BackButton object

A dedicated button that enables traversal backward through the navigation stack history.

Each page can host a back button that remains hidden until you navigate to that page from another, whereupon the back button becomes visible on the page.

The BackButton checks the navigation stack to determine whether the user can navigate backwards. If there is nothing to navigate back to, the button is not displayed. When the user clicks the button or uses keyboard shortcuts (such as Alt+Left or the browserBack keys), the back function is called and the previous page in the navigation stack is loaded. You don't have to write any code.

Explore this functionality in more depth as part of our App features, start to finish series: Flat navigation, start to finish (HTML) and Hierarchical navigation, start to finish (HTML)

Syntax

<button 
    data-win-control="WinJS.UI.BackButton">
</button>
var object = new WinJS.UI.BackButton();

Members

The BackButton object has these types of members:

  • Constructors
  • Methods
  • Properties

Constructors

The BackButton object has these constructors.

Constructor Description
BackButton

Creates a new BackButton.

 

Methods

The BackButton object has these methods.

Method Description
addEventListener

Registers an event handler for the specified event.

dispatchEvent

Raises an event of the specified type and with additional properties.

dispose

Releases resources held by this BackButton. Call this method when the BackButton is no longer needed. After calling this method, the BackButton becomes unusable.

refresh

Checks the navigation history and updates the disabled attribute value of the control.

removeEventListener

Removes an event handler registered through the addEventListener method.

 

Properties

The BackButton object has these properties.

Property Access type Description

element

Read/write

Gets the DOM element that hosts the BackButton.

 

Requirements

Minimum WinJS version

WinJS 2.0

Namespace

WinJS.UI

See also

WinJS.UI Namespace

AppBar

AppBarCommand

AppBarIcon

NavBar

Your first app - Part 3: PageControl objects and navigation

Navigating between pages (HTML)

Adding app bars

Adding nav bars

HTML AppBar control sample

HTML NavBar control sample

Navigation and navigation history sample

Designers

Command patterns

Navigation patterns

Guidelines for app bars

Bottom app bar

Top app bar