Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting MSWord with JavaScript

Status
Not open for further replies.

grx21

Programmer
Aug 3, 2001
45
0
0
US
Hello everyone,

I am writing a web app that will interact with MS Word. I was wanting to detect if MS Word is installed on a client system before they access the web app in order to let them know that if it is not istalled they need to install it. Here is what I have come up so far with the code:

script language="JavaScript">
<!--
// detection for Firefox, Mozilla, Netscape, and Opera.
var useMSW = navigator.mimeTypes && navigator.mimeTypes["application/msword"];
//-->
</script>
<script language="VBScript">
// detection for Internet Explorer.
on error resume next
useMSW = not IsNull(CreateObject("Word.Document.8"))
</script>
<script>
<!--
if (useMSW){
document.write("Microsoft Word is installed.");
}else{
document.write("Microsoft Word not found.");
}
//-->
</script>

The detection works fine for Firefox, Mozilla, Netscape, and Opera. The main challenge/problem is with Internet Explorer. When the detection runs it prompts the "user" that an ActiveX Control on the page might be unsafe to interact with other parts of the page. Knowing how certain users are he/she might freak out and hit the cancel/no button and no detection will run. I was wondering if any of you have any suggestions on how to avoid running the ActiveX control.

Thanks!

Grx21
 

I was wondering if any of you have any suggestions on how to avoid running the ActiveX control.

Just remove your code.

Of course, if you meant how to avoid IE detecting it, then you're out of luck. Security measures are there for a reason. The only thing you can do is detect that they've blocked your ActiveX control from running, and print an appropriate message.

Hope this helps,
Dan


The answers you get are only as good as the information you give!

 
No, I need to detect it with Explorer too.

grx21
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top