I have recently noticed a few sites are implementing prefixes to sites.
example: www.data.cityofchicago.org or www.mobile.smashingmagazine.com
What is the advantage of doing this and how is it accomplished?
Thanks.
A subdomain is often used to take advantage of the same origin security policy of browsers. This can be for performance, for security, or both. The same origin policy lets a developer restrict access to cookies stored on the main hostname from the subdomain.
Media files hosted on the subdomain don't have the HTTP cookie header overhead that they would if hosted from the primary hostname, resulting in a performance gain depending on how big the cookies are and how many media files are being requested.
Also, a site can link to user-generated content on a subdomain to offer a level of protection against XSS attacks. With no access to the cookies, there is less for the attacker to exploit. There's a lot more that must be done to secure a site, but every bit helps.
Subdomains let you share cookies when you want too, so they let you have multiple independent sites all share one login for example.