2

I was working on detection of adblock plugin on a web browser and i noticed that

navigator.plugins  

returns an array of PluginArray object with a list of plugins installed.

Java Applet Plug-in
Shockwave Flash
Picasa
QuickTime Plug-in

But unexpectedly it does not return all plugins, plugins such as "User Agent Switcher" and "Adblock" were not listed (contrary to what is stated in https://developer.mozilla.org/en-US/docs/Web/API/NavigatorPlugins.plugins).

Why does it not display all plugins (am i missing something) or how do i display all plugins?

Ankit Rustagi
  • 5,539
  • 12
  • 39
  • 70

2 Answers2

3

The browsers don't return an array of plugins anymore, except the most common plugins such as Shockwave flash, Java, etc. I presume to avoid browser fingerprinting. You are supposed to check for each plugin that you are interested in specifically like

navigator.plugins["Silverlight Plug-In"].name

More info here

0

You can try check how those extensions modifying your page. As example User Agent Switcher for Chrome:

if (window.new_nav && window.old_navigator && window.new_nav.userAgent === navigator.userAgent) {
    console.log('user changed navigator.userAgent, real one:', window.old_navigator.userAgent);
}

To detect adBlock you can look into this question -> stackoverflow.com

Community
  • 1
  • 1
Damian Krawczyk
  • 2,241
  • 1
  • 18
  • 26