Tuesday, November 24, 2009

Browser detection with jQuery

Those who create web apps to work for the widest possible audience, know that overcoming browser quirks is an unfortunate part of the job. The two greatest pains for me are IE6 and IE7, both common browsers with an uncommon ability to screw up my pages. (I think IE8 is a wonderful improvement to this line of browsers.) Recently I found out how to determine if a browser is IE7 or lower using this handy jQuery statement:

<script type="text/javascript">
if ($.browser.msie && (parseFloat($.browser.version) < 8)) {
// Do something for IE7 or IE6
// Like replace some image src with a gif (instead of transparent png)
// or change a style to look right
}
</script>

Of course, you must have the jQuery library included on the page before this. But this little script is great for dealing with those demanding IE-specific quirks, like display:inline uniqueness, select-box borders and transparent png support.

IP Geo-Location Database

In a previous post I talked about a nice website that will help you block countries from your site using the IP address.

In a related stream of thought, I found an entire database of IP addresses that is available for free. The nice people at IpInfoDb have an entire database of IP-to-location data available for download (in SQL, too). And, they give you some tips and PHP code on how to most effectively use it. Thanks IpInfoDb!

Saturday, November 21, 2009

Good Design

I respect good design. Or maybe I should say that I love good design. Trained as an engineer I have always appreciated the extra effort that has been put into certain objects, products, services, etc. There is something about the well designed computer or cell phone or chair, that just seems to captivate me. It is a form of art that everyone can appreciate.

I just recently watched the movie Objectified by Gary Hustwit. The movie explores the concept of design and what it means. In one interview a designer in Europe comments that the one company in the world that takes design seriously right now is Apple. I agree with that. Their products exhibit a quality of design that far surpasses many others.

It has me thinking about good design in websites. What does a well designed web site look like? How can I make my websites function and work on a higher level? It is a fun thing to think about and has my head filled with new ideas and approaches. I hope to be able to put some of it to the test soon.

Saturday, November 7, 2009

javascript compression

Compression of JavaScript is highly recommended. It reduces file sizes and quickens browser response times. There are a few good sites out there that do JavaScript compression. There are even some that will "obfuscate" your code, making it much harder to reverse-engineer.

Well, Google has released its JavaScript compression tool called Closure. There is even an online version.