how to check flash plugin is blocked in Chrome
Asked Answered
B

3

9

How can I check using jquery or javascript whether flash plugin is blocked in chrome?

We can check for disabled flash plugin using below

((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) != false));

In Chrome you can disable plugin individually by clicking on disable individual plugin. Then if we disable plugin individually, above query works and return false. But If we block all plugin it will return true only.Hence my concern is how to detect a plugin has been blocked.

Borrero answered 18/7, 2013 at 15:29 Comment(5)
Is something wrong with what you have? Is this a question, or were you attempting to answer yourself?Aluminous
what's the difference from detecting if the flash plugin is disabled or blocked? I guess you end up with the same result - no flash plugin.Unperforated
In Chrome you can disable plugin individually by clicking on disable individual plugin. Then if we disable plugin individually, above query works and return false. But If we block all plugin it will return true only.Hence my concern is how to detect a plugin has been blocked.Borrero
any possible solution for this problem ?Borrero
Some hints here: developer.mozilla.org/en-US/Add-ons/Plugins/…Kisung
U
2

You could use something like swfobject to handle flash detection, but something like this should also work;

var flashAvailable = false;
try {
  var flash = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  if(flash) {
    flashAvailable = true;
  }
}
catch(e) {
  if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) {
    flashAvailable = true;
  }
}
Unperforated answered 18/7, 2013 at 16:0 Comment(1)
In Chrome you can disable plugin individually by clicking on disable individual plugin. Then if we disable plugin individually, above query works and return false. But If we block all plugin it will return true only.Hence my concern is how to detect a plugin has been blocked.Hence above is not expected answer.Borrero
S
0

I have found that the only reliable method is to get the individual Flash element to alert the browser that it is enabled, ie. that it is not blocked.

I do this using the following code at the start of my Flash file:

import flash.external.ExternalInterface;
ExternalInterface.call('flashHasLoaded','my-identifier');

This then triggers a JavaScript function in the browser:

<script type="text/javascript">
    function flashHasLoaded( optionalIdentifier ){
        alert("A flash file has started running");
        if(optionalIdentifier == "specific-thing") alert("Specific thing loaded - do something");
    }
</script>

Remember that this wont trigger right away, only once the Flash has loaded and started to run.

Sheeting answered 22/10, 2015 at 15:2 Comment(0)
B
0

The only way I could think of checking if the browser is blocking the plugin is to make a call to the plugin and see if it returns. In your case, these steps:

  1. Check the flash plugin is installed.
  2. Initialize your flash swf as usual.
  3. Call a function through the Flash External Interface that is designed to just tell you if the plugin is responding.
  4. If it responds, carry on as normal.
  5. If it does not respond, fall back to a javascript solution ideally.

Because it's a browser security thing you do not have direct access to an api that can tell you if your desired plugin is being blocked. I think this may be the only solution available right now. Also note, that the latest version of chrome (54.0.2840.59 right now) chrome is blocking all flash if it's running in an iframe.

Bottomry answered 19/10, 2016 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.