Navigating to Another Page

I now have a page named home and a page named anotherPage in my app, how do I navigate between these two pages? You navigate between pages by using the WinJS.Navigate.navigate() method.

Let me modify the home page so we can navigate from the home page to anotherPage. Add a hyperlink to the main section of the home page that looks like this:

<section aria-label="Main content" role="main">      <p>Content goes here.</p>      <a id="lnkAnotherPage">Visit Another Page</a></section>

This hyperlink has an ID attribute but no HREF attribute.

Note

You can find the code discussed in this section in the Chapter12\Multipage folder in the GitHub source.

Next, I’ll modify the code in the home.js ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.