Search code examples
javascriptgoogle-chromeappletbrowser-plugin

Detect if Google Chrome block Java plug-in


The Google Chrome block Java plugin until you explicitly allow it to run. https://www.google.com/support/chrome/bin/answer.py?answer=1247383&hl=en-US

How can I detect in javascript if Chrome block it?


Solution

  • It's not only Chrome employing click-to-play features - Firefox (Java made click-to-play via blocklist), Opera (their Turbo mode makes all plugins click-to-play), ... and there are also Add-ons/Extensions that prevent plugins from running automatically.

    None of those allow you do find out about plugins being click-to-play from content scripts. So ideally you address the problem in a more general way.

    You can differentiate between the plugin not being installed (see navigator.plugins) and other cases by either

    • regularly testing it's scriptability or
    • having the plugin call into the pages script when it is loaded

    ... and assume "failed to load or got blocked" based on that. There is a best-practices page on MDN for this.

    That distinction should usually be good enough, check e.g. how SoundCloud handles plugins being click-to-play.