【问题标题】:How to launch any .html file on browser in UWP JS如何在 UWP JS 中的浏览器上启动任何 .html 文件
【发布时间】:2019-01-16 15:20:10
【问题描述】:

实际上我想在任何浏览器中启动任何 .html 文件。

我想在浏览器中打开key.html。

【问题讨论】:

    标签: javascript html uwp


    【解决方案1】:

    只需尝试使用Launcher.LaunchFileAsync 方法启动与指定文件关联的默认应用即可。

    // Path to the file in the app package to launch
    var imageFile = "index.html";
    // Get the image file from the package's image directory
    Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(imageFile).then(
        function (file) {
            // Launch the retrieved file using the default app
            Windows.System.Launcher.launchFileAsync(file).then(
                function (success) {
                    if (success) {
                        // File launched
                    } else {
                        // File launch failed
                    }
                });
        });
    

    您也可以使用指定的选项作为方法LaunchFileAsync(IStorageFile, LauncherOptions)

    【讨论】:

      猜你喜欢
      • 2020-08-02
      • 1970-01-01
      • 2020-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-10
      • 2012-01-11
      • 1970-01-01
      相关资源
      最近更新 更多