it’s Y! time again

Yep, it's Y!Mail time again. Warning: this might turn into a rant..

The Yahoo mail Beta blog informs us that they are rolling out a new update. Sure enough, the code has had a makeover and one of their bright new features is the following line (which I'll wrap for your reading pleasure):

if ( navigator.product != 'Gecko' ){
    document.styleSheets[0].cssText = cssContents;
} else {
    var cssTag = document.getElementById('css_place_holder');
    cssTag.innerHTML = cssContents;

Guess what? Opera isn't Gecko.
Guess what? Opera doesn't support CSSStyleSheet.cssText.
Guess what that adds up to? No CSS for you, Sir – the whole Y!Mail beta turns into an ugly, unstyled mess where no buttons or options are where they are meant to be. (Since this update is still being rolled out, you may not see it on your account yet but at least one of our test accounts gets the new code with this problem.)

If you'll excuse a bit of screaming..

I just hate this "there are only two browsers" mindset.

This sort of quick and lazy assumptions cause the worst compatibility problems across the web. And just look how incredibly simple it is to do it in a better way:

if ( typeof document.styleSheets[0].cssText != 'undefined' ){
    document.styleSheets[0].cssText = cssContents;
} else {
    var cssTag = document.getElementById('css_place_holder');
    cssTag.innerHTML = cssContents;

So what part of "avoid browser sniffing" do the Y!Mail developers not understand?


15 thoughts on “it’s Y! time again

  1. I understand we're talking about big, international companies like Yahoo! and Opera, but why do you guys announce one month that Yahoo! and Opera have an agreement to work together, and the next month you're getting stiffed by them? I don't work for Yahoo!, but *I'm* aware of the OneSearch/Mini deal, why hasn't the person(s) in charge of browser sniffing css for Yahoo! heard about it?How embarrasing is it for me to tell my friends: "Opera signed a deal with Yahoo! to enhance the mobile search experience…" only to hear them say "too bad Yahoo! mail doesn't work with Opera…."

  2. Well, it would be nice if having some sort of contract with a company meant that all their web products would be obliged to work in Opera.. The obvious answer to the "why" question is that there are different teams involved.

  3. Yes, under normal circumstances browser.js is downloaded automatically. I first need to get a file with the new patch out though, and it will probably not go live until Monday when server admin is working. Then it will take a week or so until all Opera installations have checked for updates and fetched the new patch.

  4. Excellent. Not to hijack the thread, but if you'd now care to check the progress of my bug report… The pages (e.g. ) contain the following wonderful code (which means that sometimes clicking on "pronunciation" works, often times it doesn't):Originally posted by line #159:

    <bgsound id="bgs"></bgsound> <script type="text/javascript"> </script>

    Originally posted by line #431:

    <bgsound id="bgs_sb"></bgsound><script type="text/javascript"></script>

    And this from the site used by Opera for its Encyclopedia and Dictionary hotclick items. To fix the problem, I use answers_pron.0.1.js (has a 5 seconds timeout 😉 Feel free to make a new post of it.

  5. To quote something funny:"i'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet"

  6. I'm not trying to be a fangirl or an Opera hater, but I think it's equally as stupid that when I log into I get an "invitation" to try out the beta Yahoo site…and then be told that it does not yet support my browser (Safari/WebKit). 🙂

  7. Dante: that's bug 208477, still ASSIGNED but considered high priority.janeythecrazy: yes indeed. And writing code like the stuff I quoted here makes it much harder for them to expand their browser support (I'm sure they intend to support more and more browsers but the more browser sniffing hacks they have used, the harder that is going to be!)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s