locked
Navigate does not work, where is the error ?

    Question

  • This is the default.html and the default.js :

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>YEAH BABY</title>
    
        <!-- WinJS references -->
        <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
        <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
        <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
    
        <!-- YEAH BABY references -->
        <link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.8.21.custom.css" />
        <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
    
        <link href="/css/default.css" rel="stylesheet" />
        <script src="/js/default.js"></script>
    </head>
    <body>
        <p>Content goes here</p>
        <p><a href="pages/mainPage/main_page.html">Go to Main Page.</a></p>
    </body>
    </html>


    (function () { "use strict"; WinJS.strictProcessing(); function linkClickEventHandler(e) { e.preventDefault(); var link = e.target; WinJS.Navigation.navigate(link.href); }; WinJS.Application.onactivated = function (e) { if (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { if (e.detail.previousExecutionState !== Windows.ApplicationModel.Activation.ApplicationExecutionState.terminated) { $("a").click(linkClickEventHandler); } else {

    } e.setPromise(WinJS.UI.processAll()); } }; WinJS.Application.oncheckpoint = function (e) { }; WinJS.Application.start(); })();

    Here is the main_page.html and main_page.js:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>main_page</title>
    
        <!-- WinJS references -->
        <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
        <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
        <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
    
        <script type="text/javascript" src="ms-appx:///js/jquery-1.7.2.min.js"></script>
        <link href="main_page.css" rel="stylesheet" />
        <script src="main_page.js"></script>
        
    </head>
    <body>
        <div>
            <h1>Welcome to main_page</h1>
             <p id="p1"></p>
        </div>
    </body>
    </html>

    (function () { "use strict"; function ready(element, options) { $('#p1').text('This text is from javascript'); }; WinJS.UI.Pages.define("/pages/mainPage/main_page.html", {

    ready: ready }); })();


    DOES NOT WORK. And i don't know what is wrong with it. It does work though if i don't capture the click event and use the WinJS.Navigation.navigate function, but that would beat the whole point since it's no longer one page navigation.
    Sunday, July 22, 2012 7:06 AM

Answers

All replies