Tuesday, June 22, 2010

JavaScript: IE Check

We might come across a scenario where in the JavaScript code being written should be compactable in IE and non IE browsers. A very simple check can be made for this and the snippet is as follows viz.,

if(window.ActiveXObject)
{
    alert('Browser is an Internet Explorer');
}
else
{
    alert('Browser is a Non Internet Explorer');
}