Wieder einmal brauch der Internet Explorer eine Sonderbehandlung, diesmal sollte ich über JavaScript herausfinden, welche IE Version am laufen ist. Nach zich Recherchen wurde ich endlich auf der MSDN Homepage fündig. Die folgende Funktion hab ich mir aus der Beschreibung von der MSDN Seite zurecht-gekürzt. Die JavaScript Funktion getInternetExplorerVersion() soll nun also die Version des Internet Explorers zurückgeben, easy.
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
var rv = false; // Return value assumes failure.
if (navigator.appName == ‘Microsoft Internet Explorer’)
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
var rv = false; // Return value assumes failure.
if (navigator.appName == ‘Microsoft Internet Explorer’)
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
