View the source on Yahoo's homepage...

Discussion in 'Web Design and Development' started by detz, Jan 16, 2009.

  1. detz macrumors 65816

    Joined:
    Jun 29, 2007
    #1
    Notice anything odd....




    They embed the CSS in the page, I have my ideas on why they do this but it makes the page huge.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Google isn't much better. If you check out their JavaScript you'll see they sometimes shorten
    Code:
    return false;
    to
    Code:
    return !1;
    which both equate to the same things, but the second takes less file space. Yahoo is definitely worse with their code though. You'll also notice Yahoo makes heavy use of CSS hacks.
    Code:
    _height: 1.8em;
    *margin:1px 0;
    t\op:10px;
    voice-family:"\"}\"";
    voice-family:inherit;
    property:value;
    _margin-left:0;
     
  3. memco macrumors 6502

    Joined:
    May 1, 2008
    #3
    Google does this too, but they compress their code in addition. This cuts down on the network traffic as they don't need an extra request for the JS and CSS. I haven't experimented with doing this myself, it seems like it's a lot more trouble than it's worth for small-medium sized sites. If you're Yahoo or Google though, those extra requests could be very expensive on multiple levels.
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    True, but that's only considering in a single page request. If other pages reference the same CSS and JS files, then the browser is often smart enough to see that it's the same and not download the file a second time, thus saving on bandwidth. It really depends on the setup though as to which way will save you the most bandwidth. I know Google has thoroughly thought out their technique, but still wish their pages would validate.
     
  5. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #5
    Yeah, it's like factories that find new ways to produce things so they can save 3 cents per unit. Doesn't sound like it's worth the trouble until you realize that 3 cents times thousands or millions of units adds up quickly.
     

Share This Page