How to open an Excel document using JavaScript code and without using an ActiveX control object like:
var myApp = new ActiveXObject("Excel.Application");
myApp.workbooks.open("test.xls");
I tried below option and it worked. Just prepend ms-excel:ofe|u before the url of xlsx file. It works in IE, Chrome other browsers I have not tested. This is what Microsoft One Drive online portal uses for opening encrypted xlxs files on client machines.
<a onclick="window.open('ms-excel:ofe|u|http://localhost/iis-server/test.xlsx')"> Open Excel </a>
I don't think this is possible. JavaScript, when running in the browser, should be sandboxed to the browser's process and not able to launch other applications.
You might try relying on the browser knowing that .XLS files are opened by Excel and have it change window.location to a URL that is an Excel file. But the user would have had to set up their browser and tell it that Excel files are opened by Excel and, yes, when I go to an Excel file, please open it in Excel rather than saving it to disk.
It's possible to open .xlsx files with Javascript because they are ZIP packages. This has been experimented with XForms: http://www.w3.org/community/xformsusers/2012/12/19/editing-zip-with-xforms/