Tag: fragment

当路径包含url片段时,如何在Web浏览器中打开本地html文件

我试图通过以下方法打开Web浏览器。 但是,当浏览器打开url / file路径时,片段会被破坏(从“#anchorName”到“%23anchorName”),似乎没有得到处理。 基本上,文件打开但不会跳转到文档中的适当位置。 有谁知道如何打开文件并处理片段? 任何有关这方面的帮助将不胜感激。 打开的示例路径是“c:\ MyFile.Html#middle” // calls out to the registry to get the default browser private static string GetDefaultBrowserPath() { string key = @”HTTP\shell\open\command”; using(RegistryKey registrykey = Registry.ClassesRoot.OpenSubKey(key, false)) { return ((string)registrykey.GetValue(null, null)).Split(‘”‘)[1]; } } // creates a process and passes the url as an argument to the process private […]