and the navigator object attributes (the userAgent) (Extended)

<! DOCTYPE HTML > 
< HTML lang = "EN" > 
< head > 
    < Meta charset = "UTF-. 8" > 
    < Meta name = "the viewport" Content = "width = Device-width, Initial-Scale = 1.0" > 
    < Meta HTTP-equiv = "the X-UA-Compatible-" Content = "IE = Edge" > 
    < title > navigator objects and attributes (userAgent) (extended) </ title > 
    <-!  
        Navigator object contains information about the browser 
        navigator .the userAgent; system information and user information Browser 
     -> 
</head > 
< body > 
    < Script > 
        var the Browse, NAV = the navigator.userAgent; 
        the console.log (NAV); 
        function Na () {
         var the Browse, Explorer = navigator.userAgent.toLowerCase (); // Get the browser information and it becomes lowercase 
            IF (explorer.indexOf ( " Trident " ) > - . 1 ) { // the indexOf ie returns the index ie, returns -1 if not found, to find if 
                the Browse = " IEs " ; 
            } the else  IF (explorer.indexOf ("chrome")>-1){
                browse="chrome";
            }else if(explorer.indexOf("opera")>-1){
                browse="opera";
            }else if(explorer.indexOf("safari")>-1){
                browse="safari";
            }
            return the Browse; 
        } 
        var Bro = Na (); 
        Alert ( " currently: " + Bro + " Browser " );
     </ Script > 
</ body > 
</ HTML >

Guess you like

Origin www.cnblogs.com/vinson-blog/p/12077439.html