views:

619

answers:

1

We are using MS Word as a spell checker for a few fields on a private company web site, and when IE security settings are correct it works well. (Zone for the site set to Trusted, and trusted zone modified to allow control to run without prompting.)

The script we are using creates a word object and closes it afterward. While the object exists, a winword.exe process runs, but it is destroyed when the Word object is closed.

If our site is not set in the trusted zone (Internet zone with default security level) the call that creates the Word object fails as expected, but the winword.exe process is still created. I do not have any way to interact with this process in the script, so the process stays around until the user logs off (users have no way to manually destroy the process, and it wouldn't be a good solution even if they did.)

The call that attempts to create the object is...

try {
      oWordApplication = new ActiveXObject('Word.Application');
} catch(error) {
      // irrelevant code removed, described in comments..
      // notify user spell check cannot be used
      // disable spell check option
}

So every time the page is loaded this code may be run again, creating yet another orphan winword.exe process.

oWordApplication is, of course, undefined in the catch block.

I would like to be able to detect the browser security settings beforehand, but I have done some searching on this and do not think that it is possible.

Management here is happy with it as it is. As long as IE security is set correctly it works, and it works well for our purposes. (We may eventually look at other options for spell check functionality, but this was quick, inexpensive, and does everything we need it to do.)

This last problem bugs me and I'd like to do something about it, but I'm out of ideas and I have other things that are more in need of my attention.

Before I put it aside, I thought I'd ask for suggestions here.

A: 

I have not found an answer to this problem, and I am disturbed at what the problem implies about Internet Explorer security (I forgot to mention in my previous post the version I am using : IE 7.)

However, I did implement a workaround that I am not happy with, but nevertheless feel more comfortable with than no check at all...

The code now attempts to open another object first, and if that fails the code assumes that Word will not open either and issues an error. From this point on, no more calls to new ActiveXObject() will be made and any attempt at a spell check will result in an error.

try { 
    oMSInfo = new ActiveXObject('Msinfo32.MSInfo.1');
} catch (error) {
    //  error handling code not shown...
    return;
}

This object does not start a new process when the call to new ActiveXObject() fails. It also does not have a noticable affect on system resources.

Mark Ott