Not Another IE6 Rant

Posted by Jack Hsu Tue, 21 Apr 2009 16:11:00 GMT

For the last few months I’ve seen some aggressive campaigning to rid the online world of Internet Explorer 6. Many web developers and designers have been supporting this browser for what seems like forever, and now that IE6 is losing market shares fast, it seems like a good time to make the final push to kill it.

While I whole-heartedly agree that we’ll all be better off without IE6, I don’t agree with providing zero support for the browser. Let’s face it, the whole "browser X is outdated" thing isn’t new and will always be here to haunt us – remember Netscape 4?

I don’t mind providing users with a nice message about why they should upgrade their browsers, as long as it doesn’t obstruct workflow, and they need to have an option to never be bugged again. But please, please do not do something stupid like the #ie6update script. It’s wrong on many levels, and there is a good post on why it’s wrong.

The best way to approach older browsers, I think, is to use to use graceful degradation (older concept) or progressive enhancement (better). With the latter approach, you design your website for the lowest common denominator and progressively enhance it to improve user experience for newer, more advanced browsers. Of course, while PE sounds nice in theory, it does require a fair amount of discipline in practice.

And let’s not forget that there are JavaScript libraries out there to help developers cope with IE6, and even IE7. The defacto IE6/7 library is ie7-js, which adds support for many CSS selectors that are lacking in IE6/7, as well as many other nice things.

There is also a JS library for detecting different browsers and operating systems. While I don’t personally like this approach, it may be cleaner than writing a lot of IE CSS hacks. Maybe.

Displaying URIs In Print CSS

Posted by Jack Hsu Mon, 13 Apr 2009 17:49:00 GMT

One of the fundamental features of webpages is the ability to link resources together. However, whenever you print a page, you lose all the URI information on that page. Fortunately, there is a easy way to retain these URIs even when the page is printed on paper: CSS.

A lot of websites already use print CSS files, and with a few extra styles you can have the page print with the href attributes.

a:after {
    content: " (" attr(href) ") ";
}

This CSS will append the href attirbute of the a element to itself. Of course, some URIs don’t include the http://, so you might also need to add this CSS rule, which add your website’s URI to the beginning of each link.

a[href^="/"]:after {
    content: " (http://www.mywebsite.com" attr(href) ") ";
}   

Pythonistas Rejoice! Curly Braces Are In 1

Posted by Jack Hsu Wed, 01 Apr 2009 16:09:00 GMT

Finally, we can do without the annoying "whitespace is signigicant" crap. You can import a new feature called braces from the __future__ module. For those who don’t know, the __future__ module contains new features that are not yet included in the current Python version.

Now, instead of doing this:

def foo():
    # Ugh, I hate whitespace indents
    print 'Hello Braces!'

You can do this:

from __future__ import braces
def foo() { print 'Hello Braces!' } # Only one line!!!11!!11

April Fools!