jQuery.browser
傳回一個object
{ msie : true, version : "9.0" }
或直接用javascript
var browserInfo = function() { var agent = navigator.userAgent.toLowerCase(); var that = {}; that.isIE = (agent.indexOf('msie')!=-1); //IE that.isFF = (agent.indexOf('firefox')!=-1);//firefox that.isSa = (agent.indexOf('safari')!=-1);//safari that.isOp = (agent.indexOf('opera')!=-1);//opera that.isChrome = (agent.indexOf('chrome')!=-1);//chrome that.isOther = (!this.isIE && !this.isFF && !this.isSa && !this.isOp)//unknown Browser return that; }();
browserInfo.isChrome
return:
true
沒有留言:
張貼留言