code_junkie

Is it possible to detect if Microsoft Excel is installed from a Web Application

Nov 13th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <script>
  2. var excelInstalled;
  3. try
  4. {
  5. var excel = new ActiveXObject("Excel.Application");
  6. excelInstalled = true;
  7. }
  8. catch(e)
  9. {
  10. excelInstalled = false;
  11. }
  12. alert("excelInstalled: " + excelInstalled);
  13. </script>
  14.  
  15. function hasOfficePlugin() {
  16. var toCheckExt = ['', '12', '13', '14', '15'], i, n, mt;
  17. for (i = 0, n = toCheckExt.length; i < n; i++) {
  18. mt = navigator.mimeTypes['application/x-msoffice' + toCheckExt[i]];
  19. if (mt && mt.enabledPlugin && mt.enabledPlugin.name) {
  20. return true;
  21. }
  22. }
  23. return false;
  24. }
  25.  
  26. var isExcel = window.confirm('dear user if you have Microsoft Excel installed please click on ok, otherwise click on cancel. thank you.');
Add Comment
Please, Sign In to add comment