javascript - 如何在浏览器窗口中从 Javascript Windows 通用应用程序打开 URL?

标签 javascript win-universal-app uwp windows-10-universal

如何在 Edge 或 Chrome 等浏览器中从 Javascript Windows 通用应用程序应用程序打开 URL?

使用“open”JS 函数 (window.open) 打开应用程序窗口内的 url。我想在 Edge 或默认的 Windows 10 配置浏览器上打开它。

最佳答案

您可以使用LaunchUriAsync方法。

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
    }
});

关于javascript - 如何在浏览器窗口中从 Javascript Windows 通用应用程序打开 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37366536/

相关文章:

c++ - 使用cmake创建UWP软件包

javascript - 加载页面问题

javascript - Jquery 将类添加到最后 5 个元素

c# - GridView 水平方向中的 FooterTemplate

c# - UWP Raspberry Pi 网络服务器问题

c# - 通过代码C# UWP旋转位图

javascript - 查找当前数组项的同级

javascript - 隐藏固定的社交媒体栏,直到在网页上向下滚动一定长度

c# - Windows 8.1 通用应用程序中的 BackgroundWorker 的替代方案是什么?

c# - VS2015 C# UWP 构建错误、共享项目和后台任务