Thursday, February 20, 2014

Making Technical Support Easy with Correct Browser Detection including IE11

In an ideal web application world, all your users are using the same version of the same web browser.  Unfortunately, this is not the case even in the corporate environment.  One of the most painful things to do is trying to diagnose browser specific issues and trying to determine the version of the browser that the user has.  Even if you tell your client that it is only guaranteed to work on a certain version, you still get someone using a different version.  So instead of constantly contacting the user or the IT department to determine their version, we decided to integrate browser detection logging into our iPhora logging process which tracks all user access and activities.  Therefore, when a user complains that they have an issue, we could easily look at the log and determine what browser and what version that they are using.  We incorporate that into the RESTful API to get an accurate return of browser info.

However, IE 11 as many knows does not return the correct information using dojo.isIE.  So I found in stackoverflow.com a function which I tested and works.  Now we can easily determine the browser correctly and diagnose the problem. Of course this will break in IE12.

function getInternetExplorerVersion()
{
  var rv = -1;
  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 );
  }
  else if (navigator.appName == 'Netscape')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

No comments:

CollabSphere 2022 Presentation: COL103 Advanced Automation and Cloud Service Integration for your Notes/Nomad Applications

Our presentation for CollabSphere 2022. Learn how to quickly add workflow automation into Notes/Nomad applications using No-code tools that ...