Display an “Unsupported Browser” warning in Confluence 3.4

As we continue to prepare for a Post-WCI world, you’ll see this blog starting to highlight other best-of-breed products and challenges we’ve overcome with them. Today’s post is related to the fact that Atlassian’s Confluence doesn’t support Internet Explorer 9 (in version 3.4), and how we addressed it with our client.

In analyzing our logs, fewer than 5% of our roughly 5,000 users were actually using IE9. And in our testing, most of the site worked with IE9, so we didn’t want to prevent these users from accessing the majority of the site. Finally, we didn’t want to send an email or put a message on the site that didn’t apply to the other 95% of users. The solution? A piece of Javascript in the header that would display a warning to only those users accessing the site with IE9:


This JavaScript is based on a function I found here. It’s pretty simple, and can obviously be tailored for other purposes – like IE9 not working in ALUI Publisher.

<script>
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  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 = "IE9 is not supported.\nYou're using an UNSUPPORTED version of Internet Explorer.";
  var ver = getInternetExplorerVersion();

	if ( ver >= 8.0 ) {
		alert(msg);
		ie_alert = document.createElement('div');
		ie_alert.setAttribute('id', 'timeoutwarning');
		ie_alert.style.display='block';
		ie_alert.style.backgroundColor='#FFFF66';
		ie_alert.style.padding='15px 15px 15px 15px';
		ie_alert.innerHTML=msg;
		document.body.insertBefore(ie_alert, document.body.firstChild);
	}
}
window.onload = function() {  
	checkVersion();
};  
</script>

Tags: , , ,

Leave a Reply