In this Java Script navigator Tutorial, we will get browser property by using the navigator object of the JavaScript. We will also list the default plugins installed in the browser.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<!DOCTYPE html> <head> <Title> Java Script Browser Properties </Title> </head> <body> <H2> Browser Properties</H2> <Script type="text/javascript"> document.write("<h3>Browser Name</h3>" + navigator.appName + "<br>"); document.write("<h3>Version</h3>" + navigator.appVersion + "<br>"); document.write("<h3>OS Platform</h3>" + navigator.platform + "<br>"); document.write("<h3>User Agent</h3>" + navigator.userAgent + "<br>"); document.write("<h3>Installed Plugins</h3>"); var pluginsArray = navigator.plugins ; for (i=0; i<pluginsArray.length; i++) { var plugin = pluginsArray[i]; document.write("<b>Name: </b>" + plugin.name + "<br>"); if (plugin.description.length == 0) { document.write("<b>Description: </b><br>" + "Not Available<br>"); } else { document.write("<b>Description: </b><br>" + plugin.description + "<br>"); } document.write(".................................<br>"); } </Script> </body> </html> |
Categories: JavaScript-Tube