IE “Object doesn’t support this action”
I ran into this little bundle of awesome while trying to work with JSON and jQuery. In FireFox (as always) everything worked wonderfully. But as soon as I opened it up in IE it quickly turned into anything Microsoft is involved in, a huge cluster.
After hunting and hunting I found the issue with this bit of javascript:
for(item in ResultsArray.items){….
Turns out in IE ‘item’ is a reserved word. So watch out for that.
Ugg I hate IE. I hate how it makes me scream and complain.
Damn you MS!
Thanks for the pointer from Johannes Fahrenkrug’s site.
Update: this little bit comes from Bill in the comments. Makes a world of difference and no, I hadn’t tried this. =)
for (var item in ResultsArray.items) {….
Note the ‘var’ statement.
The reason I ask is that I use the variable ‘item’ all over in my IE code and never have a problem *unless* I forget to ‘var’ a local variable named ‘item’.
Thanks, Bill.

Normally when I open one of my pages in IE and discover JavaScript errors that weren’t there in Firefox, it doesn’t take long for me to start screaming at it, like yourself.
The magic of Google steered me to this post though thankfully (only the second result I opened!) and you solved my problem within a minute of discovering it.
Thanks a million for helping to keep my blood pressure down!
You likewise saved me a lot of hassle.
You’re my hero today, sir.
I know this adds nothing exciting to the conversation, but good lord I’m glad I Googled for this right away and came across this post. It would’ve have driven me nuts! This is my usual reaction to bizarro IE javascript errors at this point: assume I’ve probably used some obscure, poorly chosen (chosen by Microsoft, I mean), non-standard reserved word. Anyhow, thanks for the time saved, and I hope it helps someone else out when the get stuck in the quicksand that is cross-browser debugging…
Did you try the following??
for (var item in ResultsArray.items) {….
Note the ‘var’ statement.
The reason I ask is that I use the variable ‘item’ all over in my IE code and never have a problem *unless* I forget to ‘var’ a local variable named ‘item’.
Cheers,
- Bill
You saved my day.
Just adding my thanks… Ran into this same issue this evening and this article saved me a ton of time.
Thanks for sharing!
Son of a …!
I had the same problem in &#*$@! IE8… turns out it’s my variable called item that caused the problem too.. I was certain at first that it was jquery that wasnt getting loaded properly in IE8… good thing i found this article by chance!
Thanks!
It is interesting in that all day long I have been testing code on IE8 that
has worked on *most* browsers rather transparently for a good year or so.
With out fault every time IE8 en counters a “for var in” statement it is throwing an “Object doesn’t support this action” error.
ON EVERY SINGLE “for (var XXX in YYY) ” statement, PERIOD!
I can try:
for (var sangfroid in smurf) {
alert(smurf[sangfroid]);
}
And every time :
Object doesn’t support this action!
Thank you sir! I’d like to echo the sentiments of JimboJones, Troy, Andy et al.
Since I am not aware of any debug tools for IE6 I was about to embark on an evening of writing alert(‘got here’); statements, but thought I’d use Google first, this was result number 2 for “object doens’t support this action” and it was spot on.
I had a local variable called ‘item’ which I renamed to ‘thing’ and it all started working