locked
Document Navigation in Windows App JS

    Question

  • I am trying to navigate the default.html file to update.html if the app is running for the first time. I am using Jquery 2 Library. The code is:

    runTime = parseInt(getSettings("runTime"));
    if (runTime == 0) {
        document.location = "settings.html";
    } else {
        runTime++;
        setSettings("runTime", runTime);
    }

    getSettingsis my custom function that grabs the local settings. In the Javascript Console, I see NAvigation Occured to update.html but the app strucks at Splash Screen.

    Javascript Console

    Tuesday, October 7, 2014 7:29 PM

Answers

  • Hi Tika,

    I can see your problem by simply create a test project, the app freeze on the splash screen.

    As I can see the app already navigate to the correct page, if you set a breakpoint here, you should be able to see the page have been navigated.

    Here I have a dirty solution for you:

        app.onactivated = function (args) {
            if (args.detail.kind === activation.ActivationKind.launch) {
                if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
                    // TODO: This application has been newly launched. Initialize
                    // your application here.
                } else {
                    // TODO: This application has been reactivated from suspension.
                    // Restore application state here.
                }
                args.setPromise(WinJS.UI.processAll());
    
                var splash = args.detail.splashScreen;
    
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.addEventListener("dismissed", onSplashScreenDismissed, false);
    
                //WinJS.Navigation.navigate("page.html","aaa");
    
            }
        };
    
        function onSplashScreenDismissed() {
            // The splash screen has dismissed and the skeleton landing page is now in view.
            document.location = "page.html";
        }

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, October 8, 2014 7:45 AM
    Moderator