如何从命令行在Edge浏览器中打开带有anchor(#)链接的本地.htm文件? [英] How to open local .htm file with anchor(#) link in Edge browser from command line?

查看:212
本文介绍了如何从命令行在Edge浏览器中打开带有anchor(#)链接的本地.htm文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过命令linе在Edge浏览器中打开带有锚链接的本地.htm文件.

I try to open local .htm file with anchor link in Edge browser from command linе.

LaunchWinApp.exe "file:///C:/index.htm#anchor.htm"

但是Edge浏览器仅打开索引页面file:///C:/index.htm,而没有其他页面.

But Edge browser opens only index page file:///C:/index.htm without additional page.

为什么会这样?

推荐答案

目前,您无法以这种方式打开本地文件.相反,您应该在目标文件夹之外托管Web服务器,并通过localhost访问资源.

For the time being, you cannot open local files in this manner. You should instead host a web-server out of your target folder, and access the resources via localhost.

Microsoft Edge团队内部目前正在就此主题进行讨论,我们可能做得到的事情将大大改善像您这样的开发人员的体验.

There are currently discussions taking place within the Microsoft Edge team around this topic, and what we may be able to do that would greatly improve the experience for developers like yourself.

如果/当我们进行更改时,影响到此问题,我将返回以更新此答案.但是,暂时最好的选择是托管本地服务器.下面提供了使用npm和Node.js进行操作的说明.

If/when we make a change, impacting this issue, I'll return to update this answer. However, for the time being, your best option is to host a local server. Instructions for doing so using npm and Node.js are provided below.

如果不确定如何站立本地服务器,请按照下列步骤操作:

If you're unsure how to stand up a local server, following these steps:

  1. 安装Node.js的最新版本
  2. 打开命令提示符,然后运行npm install -g http-server
  3. 导航到您的网站文件夹,然后按住Shift +右键单击以选择在此处打开命令窗口
  4. 运行命令http-server
  1. Install the latest version of Node.js
  2. Open a command prompt, and run npm install -g http-server
  3. Navigate to your website folder, and Shift+Right Click to select Open command window here
  4. Run the command http-server

是在线流程的GIF .

这篇关于如何从命令行在Edge浏览器中打开带有anchor(#)链接的本地.htm文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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