Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I'm curious why it is done this way. Surely, it would be simpler to just serve the actual HTML content, rather than a script that writes HTML.

share|improve this question
Spin off question:… – amanaP lanaC A nalP A naM A Nov 29 '11 at 18:52
up vote 17 down vote accepted

Historically, this was to keep Google from caching system messages.

In the olden days, a page on Stack Overflow would take an hour or so to get into Google and then stay there for a rather long time. This would mean people we're getting "The system is going down for maintenance at 11 PM EST" and stuff days, or even weeks, after the event had passed.

Loading the message in via javascript kept Google from rendering it in cache, while still serving the same HTML to everyone (making caching easier, and avoiding cloaking concerns).

Of course, it's been a looong time since that code was written and Google's gotten a lot smarter. For one, Stack Overflow pages appear almost instantly in Google (and are frequently refreshed, though we can't guarantee all pages are refreshed).

In a less good way, they've gotten a bit smarter about javascript and thus this doesn't actually work anymore*. So the system message is appearing (twice for some reason) in cache now.

We'll be changing this behavior... when we figure out another workaround.

*I discovered this while trying to remember why we did this, it's been months since anyone touched anything related to system messages. Ironically, I apparently wrote this code originally and just didn't remember it.

share|improve this answer
hehe the cache is funny. wonder why that happens. – amanaP lanaC A nalP A naM A Nov 29 '11 at 19:04
I don't think "Ironically" is used correctly here -- but I'm no native English speaker, so I'll just ask Alanis. – juanformoso Nov 29 '11 at 19:06
Thanks! I had a suspicion it was to evade unintelligent spiders. – Shad Nov 29 '11 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .