Daniel Santos Daniel Santos - 2 months ago 14
Javascript Question

How open a url from a Javascript Windows Universal application in a browser window?

How open a url from a Javascript Windows Universal Application application in a browser like Edge or Chrome?

Using the "open" JS function (window.open) opens the url inside the app window. I would like to open it on Edge or the default windows 10 configured browser.

Answer

You can use the LaunchUriAsync method.

Windows.System.Launcher.launchUriAsync(   // note that .launchUriAsync() is lowercase
    new Windows.Foundation.Uri("http://stackoverflow.com/"))
.then(function (success) {
    if (success) {
        // the launch succeeded
    } else {
        // the launch failed
    }
});