function init()
{
// Microsoft Internet Explorer
alert("test-1");
if (document.all)
{
alert("test-2");
document.all.loading.style.visibility="hidden";
document.all.myapplet.style.visibility="visible";
document.applets[0].repaint();
}
// Netscape Navigator
else
{
alert("test-3");
document.loading.visibility="hide";
document.myapplet.visibility="visible";
}
}
This javascript code clear loading text after applet loading completely. First condition is for microsoft OS's browsers. Second condition is for unix and other's browsers. But all browsers give test1 and test-3 alert message. Namely "document.all" isn't knew by all browsers. How can i distinguish browsers from each other with javascript (especially microsoft internet explorer) ?
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var isFirefox = typeof InstallTrigger !== 'undefined';
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor')>0;
var isChrome = !!window.chrome && !isOpera;
var isIE = false || document.documentMode;
Maybe this code runs for detecting browser..