如何使用markdown语法链接到任何本地文件? [英] How link to any local file with markdown syntax?

查看:2430
本文介绍了如何使用markdown语法链接到任何本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个链接的本地markdown文件,我希望这些链接指向pdf等本地文件.

I have a local markdown file containing several links and I want that links head to local file like pdf.

我使用以下语法:

[my link](file:///C:/my_file.pdf)

但是当我将markdown文件打开到Firefox页面并单击链接时,什么也没有发生.

But when I open my markdown file into a Firefox page and click on the link, nothing happens.

我到底错过了什么?可以打开本地文件吗?

What exactly have I missed? Is it possible to open local file?

推荐答案

如何打开渲染的Markdown?

How are you opening the rendered Markdown?

如果您通过HTTP托管它,即通过http://https://访问它,则大多数现代浏览器都会拒绝打开本地链接,例如使用file://.这是安全功能:

If you host it over HTTP, i.e. you access it via http:// or https://, most modern browsers will refuse to open local links, e.g. with file://. This is a security feature:

出于安全目的,Mozilla应用程序阻止从远程文件到本地文件(和目录)的链接.这包括链接到硬盘驱动器,映射的网络驱动器上的文件,并可以通过统一访问命名约定(UNC)路径. 防止出现许多不愉快的可能性,包括:

For security purposes, Mozilla applications block links to local files (and directories) from remote files. This includes linking to files on your hard drive, on mapped network drives, and accessible via Uniform Naming Convention (UNC) paths. This prevents a number of unpleasant possibilities, including:

  • 允许站点通过检查默认安装路径来检测您的操作系统
  • 允许站点利用系统漏洞(例如Windows 95/98中的C:\con\con)
  • 允许站点检测浏览器首选项或读取敏感数据
  • Allowing sites to detect your operating system by checking default installation paths
  • Allowing sites to exploit system vulnerabilities (e.g., C:\con\con in Windows 95/98)
  • Allowing sites to detect browser preferences or read sensitive data

该页面上列出了一些解决方法,但我建议尽量避免这样做.

There are some workarounds listed on that page, but my recommendation is to avoid doing this if you can.

这篇关于如何使用markdown语法链接到任何本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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