How to open a link referencing to a file system

对着背影说爱祢 提交于 2020-01-25 12:55:46

问题


How i will open the following link

<a href=file:///blablabla/folder>Open folder</a>

It is not opening on clicking the anchor.

I mean to say that if we want to access shared folder. Like from \192.168.10.1\XYZ, then.


回答1:


Are you specifying an absolute path? For example, the following will work fine in Windows:

<a href="file:///C:\MyFolder">Open folder</a>

Note also that you missed the quotes around the folder path.




回答2:


The file:

<a href=file:///tmp>Open folder</a>

works fine for me under Ubuntu 9.10 in Firefox 3.5.5 as does:

<a href="file:///tmp">Open folder</a>

which is probably better. I suspect you may be having another issue. If you're doing this on a Windows server, you may need the drive letter as well.




回答3:


I'm able to do this from windows:

<HTML>
    <HEAD>
        <TITLE>My UNC Opener</TITLE>
    </HEAD>
    <BODY>
        <a href="\\192.168.10.1\XYZ">Testing</a>
    </BODY>
</HTML>

Please note that most modern browsers know how to append the file:/// prefix to something referenced on the filesystem, however, Firefox (Tested with version 3.5.6) requires it. Thus, your code should look like this for the same example:

<HTML>
    <HEAD>
        <TITLE>My UNC Opener</TITLE>
    </HEAD>
    <BODY>
        <a href="file:\\\\\192.168.10.1\XYZ">Testing</a>
    </BODY>
</HTML>

Yes, thats five (5) backslashes (\) in there.

Hope this helps,

Thanks!



来源:https://stackoverflow.com/questions/1952489/how-to-open-a-link-referencing-to-a-file-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!