"file:///" file 协议

本文介绍了在Windows Live Writer中,图片链接使用file:///协议的情况。通过搜索和试验,作者发现file:///协议用于访问本地或网络上的文件,其格式为file:///加上文件完整路径。在浏览器或支持的程序中,这种链接可以打开对应的本地文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【问题】 
在WLW中拖入本地图片文件,然后调试过程中,选中对应图片,看到获得的对应的html源码中,图片地址是这样的: 
href="file:///C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg"> 
即使一个file加上一个冒号,再跟着三个斜杠的形式。 
想要搞懂这种写法的确切含义。

【解决过程】 
1.搜“C# file colon three slash”找到这里: 
http://bytes.com/topic/html-css/answers/154018-href-file-c-temp-target-_blank-c-temp-does-not-work-ie-anymore 
提到了说是file protocol,所以猜测估计是和http和ftp等价的某种file协议。

2.那就是和C#无关,那就去搜“file protocol colon three slash”,然后找到: 
http://www.urbandictionary.com/define.php?term=protocol%20section&defid=4118180 
解释说:

The file (colon) // (slashes required) URL is good for accessing individual files. It has the ability to access the machine you’re using, or one you’re connected to, just by typing the path, in which you do file (colon) // then another slash (making 3), then in which you type a folder name, another slash, a folder inside that, and so on, until the file name. Hit enter, and the file is accessed.

总之,就是用file:///加上对应文件的地址,打开对应的本地电脑(或者你所连接到的电脑的 ->估计指的是像windows中映射出来其他网络邻居中某个计算机为某个网盘的情况)中对应的文件。

3.试了试,在Win7的资源管理器中,直接输入: 
file:///C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg 
是可以打开此图片的。

【总结】 
用file:///+文件的地址,其实就等价于文件的地址, 
即: 
file:///C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg 
其实就等价于; 
C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg 
使得(此处Html源码中所允许的地址,对应的WLW程序)可以访问对应的文件而已。

转载于:https://www.cnblogs.com/tig666666/p/6020460.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值