views:

92

answers:

6

I know the user of my app has a local file named c:\sourcefile.cs, I need to find a way to render a link to that file so that when he clicks the link, it will open the file in Visual Studio.

This is for internal use in our dev team so I don't mind using unconventional means to do that if there is no standard way to do it.

The solution has to work with Firefox.

+1  A: 

This is not possible because of security reasons. Javascript in the browser cannot access the clients computer.

You would need to use a Java applet or something else like that to make that happen.

Ikke
A: 

I don't know about opening in visual studio, but this might work:

file:///c:/sourcefile.cs

It depends on browser, browser settings, and of course file associations.

Hogan
I tried that. If I that URL in the Firefox's address bar, Firefox displays the file content. But if an html page has a `<a>` to that URL, clicking the link does absolutely nothing. Same thing on IE.
Sly
A: 

You will have to use some sort of binary code (meaning, non-JavaScript) which will more than likely require explicit permission on the user's part to access the browser's hard drive.

For FireFox, the way to do this is through a Plugin which will give the browser the capability (or at least your plugin the capability through the browser) to do what you want, while getting the explicit security permissions.

You should start with the API for FireFox plugins and go from there. This is a FireFox-specific solution.

If you want something that is browser-agnostic at some point, you might want to look into embedding a Java applet into the page. Of course, this will require permissions from the user for the applet to access the hard drive, but it will work in any browser that has the Java plugin installed.

casperOne
A: 

You can use a link;

<a href="file:///c:/sourcefile.cs">Open File</a>

That should open the file with the default application.

Jeffrey Aylesworth
This works with local html files but not with .cs files
Russell Giddings
A: 

Latest firefox (3.6) maybe could help, try search "file api". Or you can use java applets.

Shein Alexey
+1  A: 
Gaby
Is there a way through that dialogue to specify only local files?
D_N
That *would* be a good solution. But I can't find how to *add* types to the Application tab.
Sly
updated answer to offer a way to add to types..
Gaby