[英]PDF link not working on webpage
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. 好的,所以我有一个使用HTML制作的Intranet网页,我想在打开PDF的页面上放置一个链接(绝对链接或相对链接)。 The code I use is
我使用的代码是
<a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a>
Now what ends up happening is that I get this error: 现在最终发生的是我得到了这个错误:
404 - File or directory not found.
404-找不到文件或目录。 The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
您正在寻找的资源可能已被删除,名称已更改或暂时不可用。
Is there anything wrong with my code or where I am placing the document? 我的代码或放置文档的地方有什么问题吗?
Thank You 谢谢
If you are running this on a local machine check the permissions on the PDF file that they are world readable. 如果您是在本地计算机上运行此程序,请检查PDF文件的权限是否可以在世界范围内读取。 I have this happen a lot in my OS X web directory, some files dragged in seem to have different permissions.
我在OS X网站目录中经常发生这种情况,拖入的某些文件似乎具有不同的权限。
I see a number of small... oddities... in your sample line, which may or may not be significant in themselves, but could cause problems if you're doing any post-processing of the line before it goes live. 我在您的示例行中看到了一些小的...奇怪的地方,它们本身可能很重要,也可能不重要,但是如果您在对该行进行上线之前进行任何后处理,可能会导致问题。
http://harold.local/documents/sandP.pdf
is a good destination, correct? http://harold.local/documents/sandP.pdf
是一个不错的目的地,对吗? If you drop that by itself in to the address line of your browser, you can confirm that the PDF document can be found and displayed? target=
argument and your _blank
value, again a possible risk if something later on will attempt to parse the string. target=
参数和_blank
值之间有一个空格,如果稍后会尝试解析该字符串,则可能再次带来风险。 Privacy and Security
text, which could be misinterpreted as the start of a <p
tag, probably not what you want. Privacy and Security
文本的前面,似乎有一个迷离的左角括号(或小于)符号(“ <”),该符号可能被误解为<p
标记的开始,可能不是您想要的。 I would start by verifying the destination, then adding the context around it a bit at a time until something breaks. 我将从验证目标开始,然后一次在目标周围添加上下文直到出现问题。 Failing that, find a similar working example of the
<a
usage on your local machine, and use that as a starting point for the link to your sandP.pdf document. 如果失败,请在本地计算机上找到
<a
用法的类似工作示例,并将其用作链接至sandP.pdf文档的起点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.