如何在 Microsoft Edge 浏览器中打开本地 HTML 文件? [英] How can I open a local HTML file in Microsoft Edge browser?

查看:761
本文介绍了如何在 Microsoft Edge 浏览器中打开本地 HTML 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自古以来,如果您运行网络浏览器可执行文件,大多数网络浏览器都能够打开本地文件,例如只需执行 iexplore.exe file:/c:/temp/file或通过 IShellDocView 接口.我正在尝试在我自己的程序中使用 Microsoft Edge 在 Windows 10 中执行此操作,但我不知道如何执行此操作.

Since time immemorial, most web browsers have been able to open a local file if you ran the web-browser executable, for example just execute iexplore.exe file:/c:/temp/file or via the IShellDocView interfaces. I am trying to do this from within my own program, in Windows 10, with Microsoft Edge, and am unaware of how to do it.

可执行文件似乎完全没有文档,不响应/?或/help,无论我传递给它什么都会崩溃,并且鉴于路径似乎可能会改变,可能不是直接调用此可执行文件的正确方法:

The executable appears to be completely undocumented, does not respond to /? or /help, and simply crashes no matter what I pass to it, and given that the path appears to be likely to change, is probably not the correct approach to invoke this executable directly:

  C:WindowsSystemAppsMicrosoft.MicrosoftEdge_8wekyb3d8bbweMicrosoftEdge.exe  <whatever>

Windows 中是否有可以调用的 API 来打开 Edge,即使它不是当前的默认浏览器?

Is there an API in Windows that can be invoked instead, that will open Edge, perhaps even if it is not the current default browser?

如果它是默认浏览器,我相信我可以通过 Win32 shell-API ShellExecute 做我想做的事.即使我已将其他浏览器设置为默认浏览器,我也希望能够在 Edge 中启动某些东西,以实现某些 Web 测试任务的自动化.

If it was the default browser, I believe I could just do what I want via Win32 shell-API ShellExecute. I would like to be able to launch something in Edge even if I have set another browser as my default though, for the purpose of automating certain web-testing tasks.

是否有适用于 Edge 的编程接口或 API?出于这个问题的目的,假设我想用 C 编写这个,但是无论我使用什么语言,这都应该是相同的 API,所以我没有标记这个问题 C.

Are there programmatic interfaces or APIs for Edge? For purposes of this question, let's say I want to write this in C, but this should be the same API no matter what language I'm using so I didn't tag this question C.

如果无法以编程方式执行此操作,是否可以使用命令行参数并将其传递给 MicrosoftEdge 或 MicrosoftEdgeCP 可执行文件?

If there is no way to do it programmatically, is there a command line argument I could use and pass to a MicrosoftEdge or MicrosoftEdgeCP executable?

推荐答案

目前不支持,但团队正在评估它作为一个选项.目前,在 Edge 中打开资源的最简单方法是使用 microsoft-edge: 协议处理程序.例如,您可以运行 microsoft-edge:http://stackoverflow.com 在 Edge 中打开 Stack Overflow.

This is currently not supported, but the team is evaluating it as an option. For the time being, the easiest way to open a resource in Edge is by using the microsoft-edge: protocol handler. For instance, you could run microsoft-edge:http://stackoverflow.com to open Stack Overflow in Edge.

这篇关于如何在 Microsoft Edge 浏览器中打开本地 HTML 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆