How can I control MS Excel within a browser?

I need to allow a user to open Excel files within a browser, edit them and then save them remotely back to the server.
I am using the following code to open Excel but it is popping up in a separate window outside the browser. How can I force Excel to open inside the browser ?

var myActiveX = new ActiveXObject("Excel.Application");
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Maybe not exactly an answer to your question. But have you thought of using
This takes away a lot of development and maintenance on your side.

philfcorcoranAuthor Commented:
Nice site and very good interface but it's not what I need. I am part of a team writing an application for users to edit MS Office documents remotely and save them transparently back to the server.
Opening the spreadsheet outside the browser...that behavior is dependent on the local settings of the PC with the browser and those are not available to your web server or its scripts to manipulate.  The only browser which might open the spreadsheet without opening a new window is IE and that may or may not work after the April-06 security update for IE which is also going to cripple ActiveX. (MS lost a lawsuit to Eolas on patent infringement re: ActiveX [])

As to the saving of the results: When the client browser loads an excel spreadsheet it is saved to that local machines temporary internet files (cache) and opened from there. After editing, any attempt to save changes will open a dialog to save the file on the local machine...not the server.  This of course is due to the security model of the browser and web server.  For the client to be able to save the changed file back to the server, the client must have write permissions on the server to the directory where the spreadsheet exists.

Normally, giving write access to the client browser is not a good idea.  e.g. the client can then write any file in the directory and hack away at their pleasure.  If you will do this, you should isolate the files to a separate directory or even a virtual directory outside of the web root.  Authentication is preferred so you are not giving IUSR_machine write permissions.

Http is a disconnected protocol so there is no way to maintain file lock information and multiple people could change the same file or crash into each other with an attempt to write the file simultaneously.  WebDAV may assist the with file locking issue and I notice some indication that you may be using WebDAV.

Some possibly related questions with answers:

philfcorcoranAuthor Commented:
Thanks for your response. Looks like we will have to live with Excel opening outside of the brwoser since we do not want to get involved in desktop maintenance. We developed a prototype using webdav. A user can map a drive in windows to a webdav url. Then we have a servlet respond to the webdav messages such as lock or move. The user can then open files on the web server using windows explorer, edit them and save his changes.However the client could then be any windows application such as windows explorer, excel, word etc. We want to limit the number of clients we support so we wanted to integrate better with the browser.We tried using java applets also. The  browser security model is definitely a limiting factor. The vbscript shown previously means that a user has to accept ActiveX and our operations team saw this as a security risk.
>The  browser security model ...

Yes. Many, many people run into this frustration. Thin Client, Fat Client and Browser Client all have their place, but trying to make a browser act like a thin clinet is not going to be possible because of security. Circimventing the browser's security will lead to more problems than you solve.

Java Applets, ActiveX and other technologies offer a change for more client side interaction but also come with a cost. I don;t think many of us have a grasp on what the full impact of the Eolas patent settlement will bring but I think a lot of Intranet applications are going to break in a few weeks.  Funny enough, it was mentioned that some NS/Gecko plugins also violate the Eolas patent but Eolas said they were not going to sue the open source browser companies.

For really good interaction, I tend to want to look at a server side presentation layer for the excel spreadsheets rather than opening them on the client. That involves a tremendous amount of programming and has its down side as well, but there are products available to do that.

I gave up on WebDAV many years ago for some of the reasons you are struggling with. That does not mean it does not have value or potential, but it seemed to be more trouble than it was worth.

Sorry the suggestions were not more substantive.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.