问题
I have to check whether or not the client pc has MS Office 2007 installed or not.
How can I check this using javascript?
回答1:
You cannot do this from within a browser. The browser does not allow javascript access to the client computer. It would be a gaping security hole.
Microsoft gets around this by using Active X. There are other browser-to-desktop plugins that could accomplish the same thing.
Javascript, however, is a no-go.
回答2:
You can try to do this with ActiveX. Something like:
var word = new ActiveXObject("Word.Application");
and than check operation result.
回答3:
Generally, this isn't possible.
However, if the client is using Internet Explorer, and has InfoPath installed (which is part of Office), you can check the user agent for InfoPath.2
. Another option is to check for MS-RTC LM
, if they have the Office Live Meeting installed.
This is very limiting, but it just might work on a local intranet.
回答4:
I have done this using the following script:
try{
var oApplication=new ActiveXObject("Word.Application");
if(oApplication){
document.write(oApplication.Version);
if(oApplication.Version == "12.0")
{
document.write("office07 installed");
}
}
}
catch( ex)
{
document.write(" not installed: ");
document.write(ex.message);
}
来源:https://stackoverflow.com/questions/1700150/detect-microsoft-office-version-using-javascript