Skip to content
Robert J WallaceOld magician who likes old cars, and old whisky

From the personal collection

Why I hate computers

This is what I deal with on a daily basis.  Below is a simple two line JavaScript program:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
<script type="text/javascript">
    var status = "Uncached,Idle,Checking,Downloading,UpdateReady,Obsolete".split(/,/);
    alert(status[1])
</script>

</body>
</html>

It simply splits a string on comma’s into an array.

Firefox, Opera and IE8 output an alert with "Idle"

Safari and Chrome output "n"

 

Arggghhhhh.  To get it to work in Safari and Chrome the code needs to be changed to

    var status = "Uncached,Idle,Checking,Downloading,UpdateReady,Obsolete";
    statusArray = status.split(/,/);
    alert(statusArray[1])

 

Leave a Reply

Your email address will not be published. Required fields are marked *