问题描述
这是一个非常基本的HTML问题,但我似乎无法找到答案。
This is a very basic html question, but I can't seem to locate the answer.
我在这里有一个本地文件:
I have a local file located here:
/Users/Me/Desktop/Main/June/foo.txt
在位于/ Main目录中的.html文档中,我可以使用完整路径链接到 foo.txt
文件:
In an .html document located within the /Main directory, I can link to the foo.txt
file using the full path:
<a href="file:///Users/Me/Desktop/Main/June/foo.txt">Full Path Link</a>
我想使用相对路径链接到 foo.txt
。有谁知道如何创建一个相对路径链接到这个
foo.txt
文件?
I would like to use relative paths to link to foo.txt
. Does anyone know how to create a relative path link to this foo.txt
file?
我试过了下面的代码和一些相似的排列,但我似乎无法成功地写入本地文件的相对路径链接。
I tried the code below and a number of similar permutations, but I can't seem to successfully write the relative path link for this local file.
<a href="file:///../June/foo.txt">Relative path Link</a>
预先致谢。
推荐答案
删除文件:///
部分只有 ../ June / foo.txt
。
这应该会对您有所帮助。
This should help you out.
这篇关于帮助相对路径链接到本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!