Before talking about this, we will first provide various methods to judge through Js.
Various browsers have many names (ie, FF, TT, Maxthon,...), but the kernel is still only
So many! IE kernel, Netscape kernel!
<Script language = "JavaScript">
<! --
Function getos ()
{
VaR osobject = "";
If (navigator. useragent. indexof ("MSIE")> 0 ){
Return "MSIE ";
}
If (isfirefox = navigator. useragent. indexof ("Firefox")> 0 ){
Return "Firefox ";
}
If (issafari = navigator. useragent. indexof ("safari")> 0 ){
Return "safari ";
}
If (iscamino = navigator. useragent. indexof ("Camino")> 0 ){
Return "Camino ";
}
If (ismozilla = navigator. useragent. indexof ("Gecko/")> 0 ){
Return "gecko ";
}
}
Alert ("your browser type is:" + getos ());
-->
</SCRIPT>
Go to the topic and draw a conclusion.
The onreadstatechange of Ajax does not take effect in Firefox.
In Firefox
Onreadystatechange to onload
Readstate is not supported in Firefox.
Therefore, if there are only two browsers, ie and Firefox
If (isfirefox = navigator. useragent. indexof ("Firefox")> 0 ){
XMLHTTP. onload = function (){
Alert (XMLHTTP. responsetext );
}
} Else {
XMLHTTP. onreadystatechange = function (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 ){
Alert (XMLHTTP. responsetext );
} // 200
}
}
}