为什么html对象数据标签不支持绝对路径? [英] why html object data tag does not support absolute path ?

查看:113
本文介绍了为什么html对象数据标签不支持绝对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..



我想使用HTML对象数据在我的网页中显示PDF文档,所以我需要将文件路径传递给对象数据,如果我使用相对路径意味着它支持但绝对路径意味着此对象数据不支持

Hi..

I want to display a PDF document into my web page using HTML object data,so i need to pass file path into object data if i use relative path means it support but absolute path means this object data does not support

推荐答案

这取决于HTML的提供方式。如果在Web浏览器中本地加载它而不使用任何HTTP服务器,则可以使用绝对文件路径。但这不是HTTP服务器的工作方式。通常,它无法访问托管HTTP服务器的主机上的任何文件,除了那些仅限于为您的站点设置的根目录的文件。因此,您的URL应使用相对于HTML文件的路径,或使用相对于根的URL;这个根目录的语法是〜。



-SA
It depends on how HTML is served up. If you load it locally in a Web browser, without using any HTTP server, you can use absolute file path. But this is not how HTTP server works. Normally, it cannot provide access to any files on the host where the HTTP server is hosted except those limited to the root directory set up for your site. Therefore, your URLs should use the path relative to the HTML file using it, or relative to the root; the syntax for this root directory is "~".

—SA


这篇关于为什么html对象数据标签不支持绝对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆