1

I would like to create a html page to open different file types (avi, xls, ppt, ods, pdf, etc.) that reside on the local PC. I found several posts about it and did some tests, using the <object> and <embed>. However I can't figure out what the best method (if possible) to force the browser to open the file within the html page without using external programs. At this point I'm wondering whether it is necessary to implement an applet, an application or silverlight or flex air or even a desktop application (but I would definitely avoid it). I thought possibly the use of iframe or some javascript framework ... any suggestions? thanks

1
  • If you want to do it with pure html5 you can read it with the local file API (html5rocks.com/en/tutorials/file/dndfiles). Then you'd have to code a viewer for each type. Text and image are easy, pdf.js handles pdf and webodf open document format. Ms office is challenging though. Better go with a plugin for that.
    – Antoine
    Jun 29, 2012 at 8:36

2 Answers 2

1

You can't specify how a users system opens a file, that is down to the configuration of the system viewing that page.

0

If you want to use Java and JSP, you can do it like this:

resp.setContentType("application/pdf");
resp.setHeader("Content-Disposition", "inline; filename=\"myPDF.pdf\"");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.