开发者

Web page that points to a local PDF file

Is there a way to have a web page with a hyperlink to a file, but the file is located on the local machine? I am looking at trying to host the site on a server over the net, but storing the files locally because of size. I would have the page link to a file name and add in the local directory 开发者_C百科in something like file:///directory/filename.


If it's on just your machine and you are trying to host it, why don't you just host your entire site? Surely you're not trying to host a local file.


You can include a link to a local file in a web page - but if you do so, everyone who views that page will see the link as LOCAL to their own system, so it will be broken for everyone except you (unless they all have the same file on their local system).

If this is just a page that only you will use, that's no big deal.

If what you want is for your local machine to serve that file to the world, then your local machine needs to be exposed via a domain name or static IP. Your machine is essentially becoming it's own server.

From your question, it's a little hard to tell what exactly you're trying to do.

** UPDATE **

After testing this in FF and Chrome, it looks like I may be wrong. I thought you could do this, but it doesn't seem like the browser allows it.


You can't link to a local file from your external html file. It's due to security reasons.


As explained above the answers no. If you do need to host a file but dont want to upload it to your web server for whatever reason, perhaps consider a dropbox account (that has a public folder and is free) or amazon S3 (which is not free, but probably better than dropbox).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜