bug 124242 r=timeless sr=alecf a=asa

about.html doesn't handle empty useragent
This commit is contained in:
cbiesinger%web.de 2002-03-28 21:17:18 +00:00
parent be8b7c7b47
commit a27ac8f7c4
2 changed files with 12 additions and 4 deletions

View File

@ -71,8 +71,12 @@ h1 {
<a id="mozlink" href="http://www.mozilla.org/releases/">Mozilla </a>
</h1>
<script type="application/x-javascript">
document.getElementById("mozlink").firstChild.appendData(navigator.userAgent.match(/rv:([^;)]+)/)[1]);
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
// using try..catch to handle empty useragents and other cases where the regex fails to apply
try {
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
document.getElementById("mozlink").firstChild.appendData(navigator.userAgent.match(/rv:([^;)]+)/)[1]);
}
catch (e) {}
</script>
</td>

View File

@ -71,8 +71,12 @@ h1 {
<a id="mozlink" href="http://www.mozilla.org/releases/">Mozilla </a>
</h1>
<script type="application/x-javascript">
document.getElementById("mozlink").firstChild.appendData(navigator.userAgent.match(/rv:([^;)]+)/)[1]);
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
// using try..catch to handle empty useragents and other cases where the regex fails to apply
try {
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
document.getElementById("mozlink").firstChild.appendData(navigator.userAgent.match(/rv:([^;)]+)/)[1]);
}
catch (e) {}
</script>
</td>