"file:///" file 協議

【問題】 
在WLW中拖入本地圖片文件,而後調試過程當中,選中對應圖片,看到得到的對應的html源碼中,圖片地址是這樣的: 
href="file:///C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg"> 
即便一個file加上一個冒號,再跟着三個斜槓的形式。 
想要搞懂這種寫法的確切含義。php

【解決過程】 
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協議。css

2.那就是和C#無關,那就去搜「file protocol colon three slash」,而後找到: 
http://www.urbandictionary.com/define.php?term=protocol%20section&defid=4118180 
解釋說:html

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.windows

總之,就是用file:///加上對應文件的地址,打開對應的本地電腦(或者你所鏈接到的電腦的 ->估計指的是像windows中映射出來其餘網絡鄰居中某個計算機爲某個網盤的狀況)中對應的文件。網絡

3.試了試,在Win7的資源管理器中,直接輸入: 
file:///C:/Users/CLi/AppData/Local/Temp/WindowsLiveWriter1627300719/supfiles52F410/wangdan-se-436963[2].jpg 
是能夠打開此圖片的。ide

【總結】 
用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程序)能夠訪問對應的文件而已。ui

相關文章
相關標籤/搜索