mad as a hotmail magician

Today we'll have a backstage look at the coding of one of the most important sites out there: they don't come much bigger than MSN Hotmail..

Their junkmail "Block sender" settings screen does not work in Opera. You can add addresses but not submit the final result to actually save the setting, because clicking the "OK" button seems to do nothing.

There are two subtle differences in the code sent to IE and the code sent to Opera.
Firstly, IE gets this code for the OK button:

<input type="submit" class="A" name="OK.x" value="   OK   ">

while Opera gets

<input type="button" class="A" onClick="return buildAllLists();" name="OK.x" value="   OK   ">

In other words, IE gets a submit button whose default action is to submit a form. Opera just gets a button. It will run some JavaScript when clicked and one might expect that the script, if run successfully, would submit the form. But no..

The JavaScript is also different from what IE gets. It contains an error that stops script execution.

The following line refers to the form element that contains blocked addresses. It is supposed to go through all items in the list. i is a variable that points to the currently analysed item.

while (document.listsForm.destList.options.text != "")

The problem is that when i is increased, it will eventually be a higher number than there are items in the list and then cause an error because the script is trying to get the "text" content of an item that does not exist.

It should have been written

while (document.listsForm.destList.options && document.listsForm.destList.options.text != "")

This is however not the only reason it doesn't work: even if I fix the error, it does not actually submit the form! There is nothing in the JavaScript to send the form off – it is obviously written to work with a "submit" button. The guys who wrote the JavaScript didn't communicate with those who wrote the HTML, and neither of them tested the result in Opera..

I've saved a snapshot of the page Opera gets to prove that it is so broken it won't even work in IE:
Try to go there and click the "OK" button – you will get a scripting error. That's what we call "BAD": Broken As Designed.


3 thoughts on “mad as a hotmail magician

  1. Hallvord,
    You're doing a fantastic work in this journal. Thanks!

    Just a quick question: are you submitting all these findings to the relevent sites or at least to the Open the Web dept. so they in turn will contact the owners?

  2. I'm glad you like my journal 🙂

    Yes, I generally contact the site or know that someone has. Of course not all sites are responsive (and in this age of spam filtering one can never be certain if mails even get through..)

    I have not nagged Hotmail yet but I will. Last time there were problems they were not what I'd call responsive but the problem eventually was fixed. (That problem was reported here: <; and it was working fine last time I tested it.)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s