[英]How do I link to an image from a folder outside of my localhost
I am working on embedded website that will be served by a device running Linux. 我正在开发嵌入式网站,该网站将由运行Linux的设备提供服务。 We are trying to maintain a system where editable items are in root/var/data/.. and static files are in root/opt/.. 我们正在尝试维护一个系统,其中可编辑项目位于root / var / data / ..中,静态文件位于root / opt / ..
Right now my server.js is located at root/opt/webapp/server.js, i have an html file at root/opt/webapp/html/file.html 现在我的server.js位于root / opt / webapp / server.js,我在root / opt / webapp / html / file.html有一个html文件
in the file.html i need to render images that are in the root/var/data folder, but my understanding of now this works is node considers localhost at root/opt/webapp(the location of server.js) how do I tag to a file that is outside of said local host but still within the file directory of the device? 在file.html中我需要渲染root / var / data文件夹中的图像,但是我现在对这个工作的理解是节点认为localhost at root / opt / webapp(server.js的位置)我该如何标记到一个位于所述本地主机之外但仍在设备文件目录中的文件?
I attempted an absolute path but the html just assumed that it should start the chain from localhost so 我尝试了一个绝对路径,但html只是假设它应该从localhost启动链接
looks at http://localhost:8080/file:/C:/projects/root/var/data/fms/share/icons/avocado.png 查看http:// localhost:8080 / file:/ C:/projects/root/var/data/fms/share/icons/avocado.png
The var
folder is two folders up from your .html
file, so it sounds like you're looking for either: var
文件夹是.html
文件中的两个文件夹,所以听起来你正在寻找:
../../var/data/fms/share/icons/avocado.png
(relative) ../../var/data/fms/share/icons/avocado.png
(亲戚) /root/var/data/fms/share/icons/avocado.png
(root-relative) /root/var/data/fms/share/icons/avocado.png
) It depends on how you're linking to the file, but you may also be able to use the absolute path relative to C:
: 这取决于你如何链接到文件,但你也可以使用相对于C:
的绝对路径:
file:///C:/projects/root/var/data/fms/share/icons/avocado.png
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.