chris-ELM
10/30/2013 - 10:04 PM

browser detection - quite old now

browser detection - quite old now

// JavaScript Document
function sniffer(){

	var is_iOS = false,
	_platform = navigator.platform;
	if( _platform === 'iPad' || _platform === 'iPhone' || _platform === 'iPod' ){
		is_iOS = true;
		// redirect or call non-flash stuff here
	}
}
function getVersion(){
	var iOSversion = false,
	_window = window,
	_platform = navigator.platform;
	if( _platform === 'iPad' || _platform === 'iPhone' || _platform === 'iPod' ){
		!!_window.history && !!_window.history.pushState ? iOSversion = '4+' : iOSversion = '4-';
		!!_window.matchMedia ? iOSversion = '5+' : '';
	}
}
function detectBrowserVersion(){
			var userAgent = navigator.userAgent.toLowerCase();
			$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
			var version = 0;
			
			// Is this a version of IE?
			if($.browser.msie){
			userAgent = $.browser.version;
			userAgent = userAgent.substring(0,userAgent.indexOf('.'));	
			version = userAgent;
			}
			
			// Is this a version of Chrome?
			if($.browser.chrome){
			userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
			userAgent = userAgent.substring(0,userAgent.indexOf('.'));	
			version = userAgent;
			// If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
			$.browser.safari = false;
			}
			
			// Is this a version of Safari?
			if($.browser.safari){
			userAgent = userAgent.substring(userAgent.indexOf('safari/') +7);	
			userAgent = userAgent.substring(0,userAgent.indexOf('.'));
			version = userAgent;	
			}
			
			// Is this a version of Mozilla?
			if($.browser.mozilla){
			//Is it Firefox?
			if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
			userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
			userAgent = userAgent.substring(0,userAgent.indexOf('.'));
			version = userAgent;
			}
			// If not then it must be another Mozilla
			else{
			}
			}
			
			// Is this a version of Opera?
			if($.browser.opera){
			userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
			userAgent = userAgent.substring(0,userAgent.indexOf('.'));
			version = userAgent;
			}
			return version;
			}