Chapter 8 BOM - navigator objects

navigator object, identify the client browser facto standard.

appCodeName Return code name of the browser.
appMinorVersion Returns the secondary version of the browser.
appName Returns the name of the browser.
appVersion Returns the platform and version information of the browser.
browserLanguage Returns the current language of the browser.
cookieEnabled Returns a Boolean value indicating whether the browser to enable cookie.
cpuClass Returns the CPU level browser system.
onLine Returns a Boolean value that indicates whether the system is in offline mode.
platform Return to the operating system platform running the browser.
systemLanguage Returns the default language of the OS used.
userAgent The return value of the user-agent header sent by the client server.
userLanguage Returns the natural language setting of the OS.

 

javaEnabled() Whether the provisions of Java-enabled browser.
taintEnabled() Whether the provisions of the browser to enable data stain (data tainting).

 

8.3.1 Detection plug-in

Detecting whether a specific browser plug-ins installed. You can use plugins array. Each entry in the array contains the following properties.

name: The name of the plug

description: description plugin

filename: Name of the plug-in

MIME type of plug number processed: length

// detecting plug (invalid in IE)

function hasPlugin(name) {
   name = name.toLowerCase();
   for(var i=0;i<navigator.plugins.length;i++){
       if(navigator.plugins[i].name.toLowerCase().indexOf(name)>-1){
           return true;
      }
   }
   return false;
   }
   // 检测浏览器是否有 flash插件
alert(hasPlugin("Flash"));
// 检测浏览器是否有 QuickTime插件
alert(hasPlugin("QuickTime"))

 

 

Published 54 original articles · won praise 8 · views 70000 +

Guess you like

Origin blog.csdn.net/yang295242361/article/details/94572783