Return (array) borwser
For example, if the current browser type is ie6.0, The bortings value should be ["ie", "6", "6.0"]
The first value of the array indicates the type of the browser, the second value indicates the large version of the browser, and the third value indicates the detailed version number of the browser.
CopyCode The Code is as follows :/**
* @ Author sky
*/
VaR browser = function ()
{
// The default value is IE6.
VaR _ A = ["ie", "6", "6.0"];
VaR _ S = false;
VaR _ UA = navigator. useragent. tolowercase ();
// Detect Regular Expressions
VaR _ PAT = {
Opera:/opera. ([\ D.] + )/,
IE:/MSIE ([\ D.] + )/,
FF:/Firefox \/([\ D.] + )/,
Chrome:/chrome \/([\ D.] + )/,
Safari:/Safari \/([\ D.] + )/,
Mozilla:/RV :( [\ D.] +). + Gecko/
};
For (VaR _ t in _ Pat)
{
VaR _ S = _ UA. Match (_ Pat [_ T]);
If (_ s)
{
_ A = [_ T, parseint (_ s [1]), _ s [1];
Break;
}
}
Return _;
}(),
simple demonstration: the above code should be one of the multiple methods in the framework
[Ctrl + A select all Note: To introduce external JS, refresh it before execution]