【问题标题】:How open a url from a Javascript Windows Universal application in a browser window?如何在浏览器窗口中从 Javascript Windows 通用应用程序打开 url?
【发布时间】:2016-09-18 21:22:21
【问题描述】:

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

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

【问题讨论】:

  • 完美@RaymondChen。写一个答案,我会接受它

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


【解决方案1】:

您可以使用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
    }
});

【讨论】:

  • .LaunchUriAsync() 为小写,.launchUriAsync()
  • 这个方法是异步方法吗?因为我的执行不在“then”块内。它没有给出任何错误。甚至没有投掷。
猜你喜欢
  • 2014-03-09
  • 2013-10-10
  • 1970-01-01
  • 2011-05-29
  • 1970-01-01
  • 2011-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多