List down all the plug-ins installed in your browser
To list down all the plugins installed in your web browser you can use the plugins objects under navigator object in JavaScript. This plugins object is not a JavaScript array, but of type PluginArray and it has the length
property and supports iterating it using traditional for loop and using index value to get the values. Hence we cannot use map() or reduce() methods of Array objects. We have to iterate it using for loop and get each plugin using index.
Advertisements
console.log(navigator.plugins); //PluginArray {0: Plugin, 1: Plugin, 2: Plugin, Chrome PDF Plugin: Plugin, Chrome PDF Viewer: Plugin, Native Client: Plugin, length: 3}
To get total number of plugins installed in the browser:
console.log(navigator.plugins.length); //3
To read name, filename and description:
console.log("Installed Plugins"); console.log("-----------------"); for(var i = 0; i < navigator.plugins.length; i++) { console.log("Name - " + navigator.plugins[i].name); console.log("File name - " + navigator.plugins[i].filename); console.log("Description - " + navigator.plugins[i].description); console.log("-----------------"); } Installed Plugins ----------------- Name - Chrome PDF Plugin File name - internal-pdf-viewer Description - Portable Document Format ----------------- Name - Chrome PDF Viewer File name - mhjfbmdgcfjbbpaeojofohoefgiehjai Description - ----------------- Name - Native Client File name - internal-nacl-plugin Description -