Slim Down for Summer with That's Fit

Rotating ads with Ajax

Here's another cool and useful thing you can do with Ajax: serve rotating ads. Instead of settling for a static ad on a page a user might not refresh for minutes or even hours, you can set the ads to rotate at a predetermined interval. The concept and implementation are so simple, it's a wonder this hasn't taken off more. Just put the ad inside an iframe and refresh its contents on every XHR call. (Caveat: if you're using a Strict doctype, your page won't validate, since iframes aren't valid in Strict. Perhaps there's a way to achieve the same thing using the object element?)

Reader Comments

(Page 1)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Other Weblogs Inc. Network blogs you might be interested in: