Force browser update if IE8 or older
internet-explorer, internet-explorer-8, javascript, jquery
Solution
You have two options:
Parse the the `User-Agent String`
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
function getInternetExplorerVersion() {
var rv = -1; // 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;
}
function checkVersion() {
var msg = "You're not using Internet Explorer.";
var ver = getInternetExplorerVersion();
if ( ver > -1 ) {
if ( ver >= 9.0 ) {
msg = "You're using a recent copy of Internet Explorer."
}
else {
msg = "You should upgrade your copy of Internet Explorer.";
}
}
alert(msg);
}
Using Conditional Comments:
<!--[if gte IE 9]>
<p>You're using a recent version of Internet Explorer.</p>
<![endif]-->
<!--[if lt IE 8]>
<p>Hm. You should upgrade your copy of Internet Explorer.</p>
<![endif]-->
<![if !IE]>
<p>You're not using Internet Explorer.</p>
<![endif]>
Reference: Detecting Windows Internet Explorer More Effectively
Problem
I wonder if it's possible to show a warning or open a pop-up, which would say update your IE to latest version or use Firefox / Chrome / Safari instead, when browser is Internet Explorer IE8 or older... I guess I should use that code below inside the tags... ``` <!--[if lt IE 9]> ...i should use code here... <![endif]--> ``` Is it smart to deceted browser with jQuery and loading jQuery lib? Or is it better to just use regular javascript in order to avoid additional issues with very old browsers?