We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Open word/excell file in client.

ogog asked
Medium Priority
Last Modified: 2008-01-09
Hi everyone, i'm trying something that i don't know if it's possible:

I've got a tomcat server in a linux system and i'm trying to open a file in the client machine.

The idea is, he clicks a button and, say and excell file or word file opens up. (or whatever file opens whatever program that it's extension is associated with in the client machine).

is this possible? what code should i use.? jsp or javascript is fine by me.
Watch Question

You should just need to navigate the browser to the file and the mime types should take over from there.

browsing to a .doc file should open in Microsoft Word, if the user has the appropriate application installed, and that application is set to be the default to open that type of document.

This is the behavior of the browser and the operation system.

so you could navigate to it through javascript or just use an anchor tag that points to the document. The browser should open the document in the correct application.

you can force or try to force a browser to open in a particular application by changing the mime-type of your webpage. So if you had a webpage called test.asp you could make it open with Excel if the user has Excel installed by doing the following at the very beginning of the page even before the html tag

<%@ Language=VBScript %>
   'Change HTML header to specify Excel's MIME content type
   Response.Buffer = TRUE
   Response.ContentType = "application/vnd.ms-excel"
Note, if you are trying to open a file that exists on the local users hard disk somewhere, you will need to know the path of the file on the disk and instead of http://yoursite.com/blah.doc as the href you would use
the acutal path to the document ie... c:\documents and settings\usename\desktop\blah.doc

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


i'll try that and report back points in about 3 days.

thank you very much!
b0lsc0ttIT Manager

Why did you accept that comment as the answer?  Did you try it?  Did it work for you?  Where was this page located (i.e. Internet site, intranet, local machine)?

That comment will not work in an Internet page.  The browser doesn't allow access to local file even if you know the path.  There are a few exceptions in non-Internet uses but they are browser specific and rare.  Please reply to let us know that you didn't just accept a comment.  In most cases that "answer" is wrong.



i don't have pleasure in accepting wrong answers, obviously it did work. the file is local.

the answer was simple and effective to what i looked for, otherwise i would have not reated it Ecellent.

i forgot to accept it sooner because it worked! if it didn't i would have post a comment faster.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.