locked
[UWP][HTML]Cancel system navigation in a Web Context UWP app RRS feed

  • Question

  • Hi,

    my app is suspended and i click on the pinned main tile or on the all-apps list item and open the app again, now my app resumes very fast and the last state is shown. But after some milliseconds the complete single page application is reloading.

    How can i cancel or avoid this navigation event that is triggered by the system that causes this reload?

    Thanks,
    George

    (Everything is working fine at an Hosted Web App, this navigation event is not triggered here)


    • Edited by Barry Wang Wednesday, June 15, 2016 6:35 AM title tag
    Tuesday, June 14, 2016 12:37 PM

Answers

  • Hello George,

    We have give this scenario a test and it seems it is related to this problem:

    ms-appx-web:///index.html

    If we use index.html then we won't have this problem. So the expected behavior from your last past matches your idea.

    However since the project seems do not use the local index.html, the ms-appx-web:///index.html page's behavior is more likely to be a web page behavior and it will have the navigation, maybe that is a expected behavior.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Barry Wang Monday, June 20, 2016 10:04 AM
    • Marked as answer by George Breeze Monday, June 20, 2016 5:10 PM
    Thursday, June 16, 2016 9:26 AM

All replies

  • Hello George,

    We need some more details in order to help you troubleshoot this issue:

    1. What's your last state?

    2. Did you do anything in your activated code?

    3. How did you handle your navigation?

    By default if you don't do anything the page will not load. But if you are recovered from a suspend event then the page will load. So we need some more details about how you create your navigation related code.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 15, 2016 6:41 AM
  • Hello Barry,

    here are some steps to reproduce the behavior. Regarding your questions, no custom activation code or navigation code is used.

    1.    Create a new “Web Context” UWP Project

    2.    Select a Mobile Emulator and press F5

    3.    If the app is started, press the Start Button on the Emulator to suspend the app

    4.    Go to the “All apps” list and click on the app name

    5.    Now you can see in the VS JavaScript Console a “Navigation occurred” event. This event forces to reload the page (in my case the complete SPA).

    Actual behavior
    •    The app resumes from the suspend mode and I can see the last state (all UI elements are placed where I left them). But after some milliseconds the complete single page application is reloading which takes some time.

    Expected behavior
    •    I expect that this event is not triggered if an app comes from the suspended state. So the app do not reload.
    •    I expect that the behavior is the same like I use the “app switcher” (press and hold the back button). If I resume the app from the app switcher the event is not triggering, the app is not reloading and benefit from the suspend mode.

    Best regards,
    George
    Wednesday, June 15, 2016 1:29 PM
  • Hello George,

    We have give this scenario a test and it seems it is related to this problem:

    ms-appx-web:///index.html

    If we use index.html then we won't have this problem. So the expected behavior from your last past matches your idea.

    However since the project seems do not use the local index.html, the ms-appx-web:///index.html page's behavior is more likely to be a web page behavior and it will have the navigation, maybe that is a expected behavior.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Barry Wang Monday, June 20, 2016 10:04 AM
    • Marked as answer by George Breeze Monday, June 20, 2016 5:10 PM
    Thursday, June 16, 2016 9:26 AM
  • Hello Barry,

    thanks for pointing that out. You’re right, as soon I work with the “ms-appx-web” url’s, I will get this event. So for my understanding, this “Web Context” platform is totally useless for SPA’s.  Hope the Apache Cordova platform on Windows handles that better.

    Best regards,
    George

    Friday, June 17, 2016 12:10 PM
  • @George,

    >>So for my understanding, this “Web Context” platform is totally useless for SPA’s.

    Yep I agree with that.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 20, 2016 10:03 AM