G
G
GM2mars2014-06-06 13:15:04
JavaScript
GM2mars, 2014-06-06 13:15:04

How to use javascript to determine if flash is installed in the browser or not?

There was such task, it is necessary to check javascript'om whether flash is supported in the browser or not.
If flash is supported, we include a flash player, if not, then an HTML5 player.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Lesnykh, 2014-06-06
@GM2mars

navigator.plugins VS ActiveX (IE)

G
GM2mars, 2014-10-29
@GM2mars

If anyone else needs it, here's the solution:

var checkIfFlashEnabled = function() { 
  var isFlashEnabled = false; 
  // Проверка для всех браузеров, кроме IE 
  if (typeof(navigator.plugins)!="undefined" && typeof(navigator.plugins["Shockwave Flash"])=="object") isFlashEnabled = true; 
  else if (typeof  window.ActiveXObject !="undefined") { 
    // Проверка для IE 
    try { 
      if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) isFlashEnabled = true; 
    } catch(e) {}; 
  }; 
  return isFlashEnabled; 
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question