Click to See Complete Forum and Search --> : Launch Excel using Perl or javascript?


lnong
09-09-2003, 01:29 PM
I have a link to an Excel file located on the server. When a client accesses my Perl web application and clicks on this link, the Excel application (on the client machine) should be automatically launched with the file opened, ready for editing.

I was able to achieve this with this Javascript function:


function LaunchExcel(excelFile)
{
var excelApp = new ActiveXObject("Excel.Application");
if (excelApp != null)
{
excelApp.Visible = true;
excelApp.Workbooks.Open("http://localhost/myWebApp/" + excelFile);
}
}


However, I realize that this would only work if the client's IE browser has the "Initialize and script ActiveX controls not marked as safe" option selected. This option is disabled by default.

Is there a way to achieve the same goal using Perl so that I dont have to go to each client the tell them they must change their browser's security settings?

AdamBrill
09-09-2003, 01:38 PM
No, you can't do that... It is turned off for obvious reasons. If anyone could run a program on your computer just by going on the site, it would be a major security issue...

lnong
09-09-2003, 01:53 PM
So using ActiveX objects is the only way to launch excel? no other way? (in either Perl or Javascript)

Well, I'm not trying to use my web app to actively launch Excel on the client machine, and then load the file into it. I just want a link on the page so that when the client clicks it, his browser will automatically select the right application (in this case, Excel) to open up the file. I believe that's fairly common and it doesnt really involve any security issues there.

AdamBrill
09-09-2003, 02:05 PM
The only other thing that I know of is just to provide a link to it. So just like this:

<a href="excelfile.xls">Excelfile</a>

That would basically download the file, but if the user would then click open instead of save, it should open it in excel...

lnong
09-09-2003, 02:11 PM
I tried that at first, but some kind of excel plug-in loads right into my browser's active frame. From there I can edit the file, but I cannot save it or do anything else to it. I dont see the common excel menubars anywhere.

How can I set it so that my browser will launch the Excel application instead of the plugin?