To determine the version of the browser, there is a low version prompt

Source: Internet
Author: User

1 varBrowservision = {2Get:function () {3         ///<summary>4         ///Get Browser name and version5         ///</summary>6         ///<returns type= "String"/>7         varAgent =navigator.useragent;8         varBrowser = "";9         varVersion = "";Ten         if(/msie/. Test (agent)) { OneBrowser = "IE"; A             varReg_match = Agent.match (/msie[\w\w]+;/) [0]; -Reg_match = Reg_match.split (";") [0]; -Version = Reg_match.split ("") [1]; the         } -         Else if(/trident/.test (agent) &&/rv:11.0/. Test (agent)) { -Browser = "IE"; -Version = "11.0" +         } -         Else if(/safari/.test (agent) &&! (/chrome/.test (agent)) &&! (/edge/. Test (agent)) { +             varReg_match = Agent.match (/safari\/[\w\w]+$/) [0]; ABrowser = "Safari"; atVersion = Reg_match.split ("/") [1]; -         } -         Else if(/safari/.test &&/chrome/.test (agent) &&! (/edge/. Test (agent)) { -             varReg_match = Agent.match (/chrome\/[\w\w]+\s/) [0]; -Browser = "Chrome"; -Version = Reg_match.split ("/") [1]; in         } -         Else if(/safari/.test (agent) &&/edge/. Test (agent)) { to             varReg_match = Agent.match (/edge\/[\w\w]+$/) [0]; +Browser = "Edge"; -Version = Reg_match.split ("/") [1]; the         } *         Else { $Browser = "Unknow";Panax NotoginsengVersion = "0"; -         } the         returnBrowser + "," +version; +     }, AIsie:function () { the         ///<summary> +         ///Determine if IE is -         ///& #10;--Returns 1, otherwise returns 0 $         ///</summary> $         ///<returns type= "int"/> -         varAgent =navigator.useragent; -         if(/msie/.test (agent) | | (/trident/.test (agent) &&/rv:11.0/. Test (agent)) { the             return1; -         }Wuyi         Else { the             return0; -         } Wu     }, -Ielowerthan:function(version) { About         ///<summary> $         ///Determine if IE is less than the specified version -         ///& #10;--yes return 1 -         ///& #10;--not less than the specified version returns 0; not IE returns 0; wrong parameter returns 0 -         ///</summary> A         ///<param type= "float" name= "version" > +         ///Version Number the         ///</param> -         ///<returns type= "int"/> $         if(Version! = undefined &&!IsNaN (version)) { the             varBrowser =browservision.get (); the             if(/ie/. Test (browser)) { the                 varBrow_ver = parsefloat (Browser.split (",") [1]); the                 varVersion =parsefloat (version); -                 if(Brow_ver <version) { in                     return1; the                 } the                 Else { About                     return0; the                 } the             } the             Else { +                 return0; -             } the         }Bayi         Else { the             return0; the         } -     } -}
View Code

These are some of the logic of the browser version judgment, and then we just need to invoke the IF (Browservision.ielowerthan (8)) {

Operation of the lower version browser. I used two brothers. Div contains normal content and hint content, with the effect of the DIV's explicit hiding
$ (". Js-content"). Hide ();
$ (". Js-update"). Show ();
}

To determine the version of the browser, there is a low version prompt

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.