Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've been working with the XMLHttpRequest object in JavaScript recently, and I couldn't help but notice that the casing of this name makes no sense. Why is 'XML' all in caps while 'Http' is not? They're both acronyms!

Surely it'd make more sense for the name to be one of the following:

  • XmlHttpRequest (PascalCase, best practice for class names in JavaScript)
  • xmlHttpRequest (camelCase, also common though not for classes)
  • XMLHTTPRequest (caps-for-acronyms, rarely used in programming?)

I'm sure there must be some reason and I'd hate to think it's now set in stone just because no one questioned this at the time. Is there another naming convention that I'm unaware of?


XMLHttpRequest specification: http://www.w3.org/TR/XMLHttpRequest/

share|improve this question
Sidenote: Java has a very similar naming inconsistency: The HttpURLConnection. –  Joachim Sauer Jul 19 '12 at 10:41
Sidenote #2: At least those are correctly spelled, unlike the HTTP_REFERER header... –  OnoSendai Dec 5 '13 at 21:27

1 Answer 1

up vote 7 down vote accepted

Interestingly enough, Microsoft first called it IXMLHTTPRequest when it was first added to the MSXML library.

It was Mozilla that used the name XMLHttpRequest when it added the concept into Gecko, implementing it the idea to mimic the MS interface. It has since become the defacto standard, tying all other implementations to Mozilla's decision.

You'd have to go spelunking in the Mozilla Bugzilla to see if you can find any reasoning for the caps change there, but I suspect that not much thought went into it and the lowercasing of the ttp part is accidental.

This is corroborated by the misspelling of the Microsoft interface in the nsIXMLHttpRequest interface definition (earliest revision in the Mozilla Mercurial repository):

Mozilla's XMLHttpRequest is modelled after Microsoft's IXMLHttpRequest object. The goal has been to make Mozilla's version match Microsoft's version as closely as possible, but there are bound to be some differences.

share|improve this answer
Ah I see, so it's intentional in so far as it's based on an earlier instance of the spelling. I still don't like it - but at least I can understand how it came to be. Thanks for an excellent answer. –  Alec Jul 19 '12 at 9:36
Note that while XML and URL are commonly all-caps, references to lowercase http are ubiquitous in HTML. So XMLHttpRequest may be viewed as camel casing of the combined identifiers. –  hardmath Jul 19 '12 at 12:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.