2

I need to know if MS Office 2013 installed on user machine to use specific way of opening office documents for editing from website.

Maybe there are some plugins/activex specific for Office 2013?

I tried to find out how Sharepoint does this task but it is too tricky:

this.IsProtocolHandlerEnabled = function(d) {
        if (IsStrNullOrEmpty(d))
            return false;
        if (b[d] != null)
            return b[d];
        if (c)
            return a;
        ...

'a' equals 'true' if office 2013 is available and 'false' otherwise but I can not find the place where variable 'a' was changed.

Taras Kozubski
  • 1,854
  • 1
  • 20
  • 33
  • Looks minified, `a` might be set to true someplace as a global. – travis Jul 17 '13 at 16:19
  • possible duplicate of [detect microsoft office version using javascript](http://stackoverflow.com/questions/1700150/detect-microsoft-office-version-using-javascript) – Adriano Repetti Jul 17 '13 at 16:25
  • @Adriano: that link doesn't provide an answer, just denial and IE-only stuff... – dandavis Jul 17 '13 at 16:27
  • @dandavis because AFAIK such informations aren't available for JavaScript (because they're in Registry) so you have to use an ActiveX object (=only IE). Even SharePoint integration isn't good for other browsers. – Adriano Repetti Jul 17 '13 at 16:34
  • 1
    @Adriano: it's in a plugin, i don't see why that doesn't count... – dandavis Jul 17 '13 at 16:41

1 Answers1

7

this method worked for me in chrome, you may have to dumb-down the iteration for older copies of IE:

var has2013=([].slice.call(navigator.plugins)
    .filter(function(a){return a.name.match("Microsoft Office")})[0].name||"")
    .match(2013)||false;

alert(has2013);
dandavis
  • 16,370
  • 5
  • 40
  • 36