2

I have created project "Progressive Web App" based on JavaScript with Visual Studio 2017. The created project contains a file "package.appxmanifest". In this file a StartPage is defined. Is it possible to dynamically set this StartPage when the user installs the app?

stefischer
  • 43
  • 3

1 Answers1

1

You can't dynamically set the StartPage within the package.appxmanifest.

You can think of a UWP project created with PWA as a directed browser. The launch of the page is done in Javascript. So if you want to redirect the page, you should also do it in Javascript.

If you add your web address to package.appxmanifest -> Content URIs and have access to WinRT APIs, you can listen for navigated event.

window.onload = function () {
    if (window.Windows) {
        Windows.UI.WebUI.WebUIApplication.addEventListener("navigated", function (navigatedEventArgs) {
            // navigate to other page
        });
    }
}

Best regards.

Richard Zhang
  • 7,523
  • 1
  • 7
  • 13