【发布时间】:2019-01-16 15:20:10
【问题描述】:
实际上我想在任何浏览器中启动任何 .html 文件。
我想在浏览器中打开key.html。
【问题讨论】:
标签: javascript html uwp
实际上我想在任何浏览器中启动任何 .html 文件。
我想在浏览器中打开key.html。
【问题讨论】:
标签: javascript html uwp
只需尝试使用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)。
【讨论】: