Apply browser detection patch which will allow us to determine browser name
with a single line, which is useful for the places in the code where we care about what browser we're dealing with. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3322 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -965,3 +965,41 @@ OpenLayers.Util.removeTail = function(url) {
|
||||
}
|
||||
return head;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @returns A two-character string which specifies which is the current
|
||||
* browser in which we are running.
|
||||
*
|
||||
* Currently-supported browser detection and codes:
|
||||
* * 'opera' -- Opera
|
||||
* * 'msie' -- Internet Explorer
|
||||
* * 'safari' -- Safari
|
||||
* * 'firefox' -- FireFox
|
||||
* * 'mozilla' -- Mozilla
|
||||
*
|
||||
* If we are unable to property identify the browser, we
|
||||
* return an empty string.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
OpenLayers.Util.getBrowserName = function() {
|
||||
var browserName = "";
|
||||
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if ( ua.indexOf( "opera" ) != -1 ) {
|
||||
browserName = "opera";
|
||||
} else if ( ua.indexOf( "msie" ) != -1 ) {
|
||||
browserName = "msie";
|
||||
} else if ( ua.indexOf( "safari" ) != -1 ) {
|
||||
browserName = "safari";
|
||||
} else if ( ua.indexOf( "mozilla" ) != -1 ) {
|
||||
if ( ua.indexOf( "firefox" ) != -1 ) {
|
||||
browserName = "firefox";
|
||||
} else {
|
||||
browserName = "mozilla";
|
||||
}
|
||||
}
|
||||
|
||||
return browserName;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user