1//gets the type of browser
2function detectBrowser() {
3 if((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1 ) {
4 return 'Opera';
5 } else if(navigator.userAgent.indexOf("Chrome") != -1 ) {
6 return 'Chrome';
7 } else if(navigator.userAgent.indexOf("Safari") != -1) {
8 return 'Safari';
9 } else if(navigator.userAgent.indexOf("Firefox") != -1 ){
10 return 'Firefox';
11 } else if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) {
12 return 'IE';//crap
13 } else {
14 return 'Unknown';
15 }
16}