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

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

问题描述

自远古以来,如果您运行Web浏览器可执行文件,大多数Web浏览器便能够打开本地文件,例如,只需执行iexplore.exe file:/c:/temp/file或通过IShellDocView界面即可.我试图在Windows 10中使用Microsoft Edge在自己的程序中执行此操作,并且不知道如何执行此操作.

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

  C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe  <whatever>

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

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

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

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

解决方案

当前不支持此功能,但团队正在对其进行评估.目前,在Edge中打开资源的最简单方法是使用microsoft-edge:协议处理程序.例如,您可以运行 microsoft-edge: http://stackoverflow.com 在Edge中打开堆栈溢出. /p>

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.

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:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe  <whatever>

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?

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.

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.

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?

解决方案

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天全站免登陆