How to open a link referencing to a file system

2019-08-20 20:26发布

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.

3条回答
狗以群分
2楼-- · 2019-08-20 20:38

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!

查看更多
Deceive 欺骗
3楼-- · 2019-08-20 20:44

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.

查看更多
叛逆
4楼-- · 2019-08-20 20:50

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.

查看更多
登录 后发表回答