How to open local .htm file with anchor(#) link in Edge browser from command line?

别说谁变了你拦得住时间么 提交于 2020-01-15 03:14:31

问题


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

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

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

Why is this happening?


回答1:


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.

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.

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. 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

There is a GIF of the process online.



来源:https://stackoverflow.com/questions/35038599/how-to-open-local-htm-file-with-anchor-link-in-edge-browser-from-command-lin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!