JS界的tiny detecting

ie = '/v'=='v';
ie = !!top.execScript;
ie = /*@cc_on!@*/!1;
ie8 = !!window.XDomainRequest;
IEVersion = 0/*@cc_on+ScriptEngineMajorVersion()@*/;
ff = /a/[-1]=='a';
ff3 = (function x(){})[-5]=='x';
ff2 = (function x(){})[-6]=='x';
safari=/a/.__proto__=='//';
chrome=/source/.test((/a/.toString+''));
opera=/^function (/.test([].sort);

上面的代码很神奇,更重要的是:It works!

你可能感兴趣的:(function,Opera,chrome,IE,Safari)