Here is one simple Javascript class for finding the Browser name and Browser Version. This one is a very basic class.
Here is the code for the browser class.
//Browser class
var Browser={
name:'',
fullname:'',
version:'',
Init:function(){
this.fullname=navigator.userAgent;
if (navigator.userAgent.indexOf("MSIE")>-1)
this.name='IE';
else if(navigator.userAgent.indexOf("Opera")>-1)
this.name='Opera';
else if(navigator.userAgent.indexOf("Firefox")>-1)
this.name='Firefox';
else if(navigator.userAgent.indexOf("Chrome")>-1)
this.name='Chrome';
else if(navigator.userAgent.indexOf("Safari")>-1)
this.name='Safari';
else
this.name=navigator.userAgent;
this.version=this.fullname.substr(this.fullname.indexOf(this.name)+this.name.length+1,1);
}
};
Hope this will be a good starting
Shidhin
No comments:
Post a Comment