开发者

How to open a link referencing to a file system

开发者 https://www.devze.com 2022-12-14 14:09 出处:网络
How i will open the following link <a href=file:///blablabla/folder>Open folder</a>开发者_StackOverflow中文版;

How i will open the following link

<a href=file:///blablabla/folder>Open folder</a>开发者_StackOverflow中文版;

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.


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.


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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消