Possible Duplicate:
Why use document.write?
Considering the negative effects of document.write(), why are most tracking/marketing tags written using document.write()?
I’ve thought about it quite a bit, and the only respectable idea I’ve come up with is that by writing it client side, we’re guaranteed the browser won’t try to cache the resource. Is that it? Any other ideas?
It’s definitely ugly, but it’s about the most battle-hardened, dumbed-down, idiot-proof method there is. The paradigm of “write this content onto the page right here” leaves little room for surprises, and the implementation works reliably at least all the way back to v3 browsers, possibly earlier.
[edit] “v3” browsers, not as in Firefox 3, but as in Netscape 3. If Netscape still existed today I suppose it would be at version 11 by now.