Monthly Archives: March 2014

Adding a placeholder page in WinJS App

Published March 13, 2014 11:14 am

If you are building a winjs app – you may hit the need for a placeholder page. What I mean by placeholder page? Examples: initial login page. Once user has logged in, it should not show up in the navigation history; that is user must not be able to navigate it using back button on the next page.

This leads to obvious question – how do I remove a page from navigation history or how do I navigate to a page without adding it to <code>WinJS.Navigation.history</code>.

I made a failed attempt by resetting <code>WinJS.Navigation.history.backStack</code> when the navigate promise completes for the next page. This does not work since next page is already rendered by then and next page back button is visible. Clicking on the back button there does not do anything. but it must not be visible.

Next – google pointed to solution here by Kraig. This one line of code is the solution and needs to be placed when navigating away from the initial placeholder page like login page.

    WinJS.Navigation.history.current.initialPlaceholder = true;