我正在使用<a href="file:...">
Intranet 内的链接进行本地文件夹访问。
让我烦恼的是,为了跨浏览器兼容性,我必须在这些 URI 中写入大量的斜杠。
Internet Explorer 11.904.16299.0
file://server/share/path/to/file ok
file:///server/share/path/to/file not working
file:////server/share/path/to/file ok
file://///server/share/path/to/file ok
Edge 41.16299.820.0
file://server/share/path/to/file ok
file:///server/share/path/to/file not working
file:////server/share/path/to/file ok
file://///server/share/path/to/file ok
Firefox 60.0 with Local Filesystem Links Extension
file://server/share/path/to/file not working
file:///server/share/path/to/file not working
file:////server/share/path/to/file not working
file://///server/share/path/to/file ok
Run Code Online (Sandbox Code Playgroud)
当我在 Stack Overflow 或类似网站中寻找答案时,我最终在这些帖子中发现,正确的数量是 3 个斜杠。
我写下这个问题并回答它,以防有人像我一样感到困惑。