Skip to content

Instantly share code, notes, and snippets.

@chantalgo
Created May 25, 2013 01:36
Show Gist options
  • Save chantalgo/5647557 to your computer and use it in GitHub Desktop.
Save chantalgo/5647557 to your computer and use it in GitHub Desktop.
Back button navigation

#Back button

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.

<button
data-win-control="WinJS.UI.BackButton">
</button>
var object = new WinJS.UI.BackButton();
//disabling and hiding backbutton
document.querySelector(".win-backbutton").disabled = true;
// freeing navigation stack
WinJS.Navigation.history.backStack = [];
WinJS.Navigation.navigate("/pages/groupedItems/groupedItems.html");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment