David Garcia
David Garcia

Reputation: 2696

Detect if extension is enabled on Chrome browser

I am writing a small plugin for Wordpress and I need to detect whether a chrome extension is "Enabled".

At the moment I am able to detect if an extension is "Installed" only by connecting to one of its resources, However, I need to detect if the installation is "Enabled" or "Disabled"

Is this possible guys?

Thanks for your time.

Upvotes: 1

Views: 2252

Answers (1)

sowbug
sowbug

Reputation: 4672

You have a few options.

  1. Make an extension of your own that declares the management permission and then reports the results of get or [getAll][1] to your plugin, then examines ExtensionInfo for the enabled/disabled state.
  2. Change the extension you're interested in to alter the page's DOM in some way that the plugin can detect. E.g., add an invisible div with ID "yes-the-plugin-is-installed."
  3. If you don't have control over the extension and don't want to write your own extension, then figure out how the extension changes the behavior or structure of the page, and write code in your plugin to detect it. This method is fragile, of course, but it doesn't rely on any extension code whatsoever to work.

If you're looking for a general answer of how an arbitrary web page can detect an arbitrary extension, there is no such method. There are two reasons this is true. First, Chrome (like most other web browsers) generally avoids making proprietary extensions of this sort to the open web, and what you're asking for is exactly that -- a special method for normal web pages to ask about Chrome extensions. Second, for privacy reasons Chrome wouldn't provide a non-privileged method for an extension or webpage to query which extensions the user has installed. You might have the Embarrassing Foot Fungus Prevention Extension installed on your machine, and it would be upsetting if random web pages could learn that about you.

Upvotes: 1

Related Questions