Why Browser Sniffing is a Bad Idea

For many web developers, browser sniffing has become almost routine. Have you ever noticed that short list of “supported web browsers”?

While browser sniffing may seem like a good idea at first, you may be setting yourself up for problems later.

The biggest problem with browser sniffing is that it is usually relied on far too heavily to even consider removing later. The inner workings of a site can be based (unknowingly sometimes) around working specifically for specified web browsers and nothing more.

One poor use of browser sniffing that I came across today was for EyeWearSelect.com and it just so happens to be an easy fix.

On one of the EyeWearSelect pages, they show a thumbnail preview of a pair of glasses. Below the image is a link entitled “Click to Enlarge”, which uses some javascript to show you a larger picture in a pop-up window. Here’s how they begin the pop-up script..

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}

Basically, the script says…true or false…this is Netscape? Also, true or false…this is Microsoft (Internet Explorer)? ..but what if you’re not using Netscape or Internet Explorer? What if you’re using Opera? or Konqueror?

If you’re using a browser that doesn’t match Netscape or Internet Explorer, then the future checks for isNN and isIE will never match and your browser will be “incompatible” with the scripts. In this case, the incompatibility is that the author never made it possible for those that are compatible.

A simple fix for this would be to change that bit of code to the following, which would basically check for Internet Explorer and then treat all others differently..

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
var isNN=!isIE;}

They won’t always be this easy for developers to correct, but this script could actually be cleaned up much more than just that.

In most cases, browser sniffing isn’t needed. The more efficient method to follow is capability testing.

If your code requires a web browser with capabilities that others (or not all web browsers) have, then you can use browser sniffing which is a form of hard coding the compatible web browsers…or you can test the browser’s capabilities and see if the javascript that you need to use will be supported.

By using the second method, you make your script much friendlier to the future of both the web and it’s browsers. You will also save yourself some work by not having to update the script each time you want to support another browser that would already be capable of using your script if it weren’t blocked in the first place. ;)

If you run compatibility tests and find that a certain feature will not be available, that’s the time to announce that the user should update their browser or use a different one all together.

Of all of the times that I’ve seen browser sniffing, only a couple have every been properly used. One of those was a browser sniffer that would display instructions and images explaining how to download and save a file to your computer. The images were of course specific to the browser that I was using for a more useful set of instructions.

If you should happen to come across a web site that suggests that your browser is not compatible, fire off an email and let them know that you would appreciate more accurate scripting and detection for your web browser let them know that you would appreciate more accurate scripting!

Managing A Music Collection

So I entered the 21st century a bit early and began ripping my cd collection to mp3’s long before a decent cd ripping tool was available to me.

You know, the kind that will label the tracks properly, organize them into a hierarchy that makes sense (such as Artist/Album/Track Number – Track Title), make sure that you’re not ripping duplicates from an artist (by ripping their individual albums and then their Greatest Hits albums), pour you a glass of milk and bake you some cookies, etc.

When I backed up my entire cd collection ages ago, I had to tag and sort most of the music myself. This worked well then since no one really had most of their music in mp3 collections (that I knew of) and there was no “good procedure” to organizing your music.

Now, I find myself deleting chunks of my library so that I can rip them again, this time with smarter tools. ;)

One program that I’m beginning to use for those tracks that just need a little TLC is “MP3 Diags”. It seems to offer fixes for pretty much any problem that you have with your mp3 collection.

I’ve also been considering ripping my collection to ogg format or maybe even flac (lossless), but I’m still unable to justify the benefits when mp3 has served me so well thus far.

If you have any opinions or suggestions, I would love to hear them!

Replacement Bimmer

76_bmw_2002_wgvr_03_01

While my 325is is at the shop being worked on (heater core, tires and more..) I get to drive my dads 1976 BMW 2002!

76_bmw_2002_wgvr_03_01
(Not actual picture, but darn close. ;) )

It’s in pretty decent shape and runs strong…and with no power steering it’s a fun car to take into the curves.

Linkin Park

I just realized last weekend how little I’ve listened to Linkin Park since High School when I was prepping myself for a soccer game to the Hybrid Theory album.

I remember thinking how cool that entire album was and it’s no surprise that after I play through it again now, I still enjoy it!

What is a surprise, however, is the major difference between Linkin Park then and Linkin Park now.

Right off the bat I must tell you that I “hate” their newest album. I don’t know much about it, but the style is so different.

Well, a different style isn’t what makes them bad. It’s that they have lost everything that made them unique before.

Blink-182 changed styles several times and each of which I was overall impressed with.

Sorry to all of you Nickelback fans, but Linkin Park is starting to reach the same “low” in my opinion.

What are your general opinions on Linkin Park’s new material and the direction they are moving towards?

New WordPress Twitter Badge Plugin!

wp-twitterbadge-01

After coming across this nifty little Twitter Badge at Techie-Buzz while reading a Google Chrome OS article, I realized how cool their little Twitter link was and I instantly new it was going to be on kyleabaker.com as well. :D

wp-twitterbadge-01

After a quick look at the source code of the page, I had decided to build a quick plugin for WordPress to insert the same code. So the plugin process began.

I didn’t want to hard code it into the footer of my K2 theme, because I frequently update to the latest K2 theme nightly builds. This way would save me a lot of trouble and even make this neat little Twitter Badge available to thousands. And so…WP-TwitterBadge was born.

wp-twitterbadge-02

I traced the code back to an embeded script from go2web20.net and realized how n00b friendly this script would have been to install anyway even without an easier plugin to install it for you, but the fact that it would save me time in the future was well worth it.

Basically, if you’re not using the WordPress plugin, you just link the script and set a few variables. This made it very easy to make it customizable as well!

Just mimicking their own setup page, I was able to make a quick Options page featuring a live preview (as all of my plugins have so far ;) ). I even coded the preview with way less script than they used on their own page since extreme error checking is really not needed (everything is live so you can see the problems there).

wp-twitterbadge-03

At a rate of 20-30+ new downloads per hour I would say that this plugin is by far my most favored project…considering that it hasn’t been reviewed yet (no trackbacks thus far) by anyone whereas others already have.

If you’d like to checkout this little Twitter Badge on your own site, just head over to the plugin page or search for “WP-TwitterBadge” from your “Add New Plugins” page in WordPress and install it from there. If you like it, pass it on!

Google Chrome OS

google-chrome-os-cartoon

We’ve all heard the rumors about Google secretly building an operating system…or was it just my imagination? ;)

Now that the news about Google Chrome OS is out, I’d like to be the first to start a few new names for the operating system.

From the Unix side of the naming ideas I come up with Google ChrOS which would be pronounces Google Crow-S (similar to the idea of BeOS). It could be shortened to read GOS, making it “short and cool” like Mac, but it just doesn’t have the same cool ring to it. Or how about Google COS? Or GhrOS?

I’m not a big fan of the current name Google Chrome OS. Some would say that this is a very Mac naming system, but I think Google OS 1 would have been perfectly fine. Even if Chrome is later evolved to a point in the operating system that later barely resembles Chrome as we know it today it could still continue with this naming system as Mac OS did with 8/9 and then X which was completely different.

News of Google Chrome OS has been spreading like wild fire through my Google Reader feeds and even via Twitter reaching at least 6th place on Trending Topics.

With Google’s experimental project called Native Client (NaCl) in the works, it appears that Google is attempting to do something similar to what Microsoft attempted to do ages ago with ActiveX. Where Microsoft has (in my opinion) failed, it appears that Google’s Native Client may succeed at allowing support for web browsers to natively execute code for a deeper integrated position with…Google Chrome OS.

With all of this news about Google finally graduating their entire suite of web apps (from what seemed like and eternal Beta stage to what is now considered final and safe for public usage) it seems all too clear that they have an evil plot to take over and dominant the PC world.

The general idea of Google Chrome OS is similar to what I have been want to create for nearly two years now. Don’t get me wrong, I didn’t originate this idea, but then again neither did Google. ;)

Basically, Google will be using the Linux kernel to start up and run in the background and to handle hardware and software interactions. That is all in the background, things you won’t see all that much of.

What you will see is that when you turn on your computer, instead of seeing the dominance of applications in the sense of executables, your applications will be web based applications that integrate nicely with the rest of the system.

In fact, if Google is able to implement this operating system as I would love to have been able to do myself (had I of been able to of found the time) then it will integrate so tightly with the web applications that you will (hopefully) not notice a difference between the two.

This is important for any operating system. The sense of integration is clearly important. Take a look at Mac OS X for example and their strict code of proper layout and design with a balance of clean and elegant user interfaces. If Google Chrome OS is able to bring this level of integration from the web and merge it with the general set of tools and applications provided then it just may be a success.

With so much of our time being spent on the web already, will it really be that difficult to make a move to a web based operating system?

Several tools are also available straight from the web, just proof that the web is the future! Take this web based screen recorded for screencasts provided by Screenjelly!

You can watch most anything video-wise from the web already! The one thing that I’m really waiting for is for large amounts of storage in the clouds for a super cheap price!

Just a neat little cartoon to leave you pondering. :)

google-chrome-os-cartoon

VHS-to-DVD Conversions

I kept claiming that I was going to get this done a long time ago.

I have a bunch of home videos that I want to convert to DVD so we can hold on to them longer. So far I have a few converted, but I must have gotten side tracked.

It’s time to pull out all of my video conversion hardware and start up the process again. Hopefully I get a little more done this time around than I did before.

Opera Wishlist v2.0

It’s been a while since I’ve written my wishlist for Opera. Now that the top five features I’ve requested have been implemented in Opera 10 (to be released), I’ve got to start putting together some items for the next major update!

In my previous top five wishlist, I was hoping for features like Developer Tools, Auto-Update, more Widget Capabilities, In-line Spell Check and, last but not least, an Improved Interface.

I’ve updated my previous wishlist with links to reference when and how these changes took place, so if you want to look further into that just checkout the first wishlist (linked above).

For my new wishlist, I think the them follows the general theme of the previous one..or at least 3/5 of them. I hoping to see Opera become more noob friendly. In it’s current state, it’s very usable for anyone, however, they do tend to have a bit too much of an engineering took and a little skittish on the designer and user interface front.

Let’s dive right in..

  1. Menu Systems. The menus for toolbars and even some main menu bar sub-menus are designed too complex and confusing. If you want one of your less tech. savvy friends to use Opera, don’t show them (most) of the menus! An example of simplifying the menu system would be to simply move the “Customize -> Remove From Toolbar” to the main menu or root level and rename it to “Delete” so that deleting buttons and other toolbar elements is written in clear English.

    This menu item was moved to a sub-menu to reduce accidental use, however, it is now placed far out of reach and over complicates such a simple task. The naming or wording of this menu item is also overly complex. Firefox uses a simple “Delete” menu item for the same task and it makes the whole thing seem so much simpler.

    This isn’t the only menu item or menu that is in desperate need of simplifying. I’d like to see each and every menu analysed and modified to make wording as simple as possible and follow general layout structures that all other competitors are using.

  2. Completed Opera Link. Depending on how heavily you use Opera, you may know by now that they have a feature that allows you to synchronize some of your settings between different computers by signing into your (free) My Opera account. This way you can have the same settings for Opera on two or more different computers such as the same Bookmarks or Speed Dial entries.

    I would like to see Opera finally complete this feature to support all of the other settings that you hate to update all of the time, such as Blocked Content, Mail Accounts or News Feeds, Widgets, IRC, etc. Currently, the only synchronized settings are Bookmarks, Speed Dial, Personal Bar, Notes, Typed History and Searches.

  3. [done] <video> and <audio>. Opera already has some support for HTML5, however, the very cool parts are still lacking. Firefox 3.5 just released yesterday with support for the new <video> tag that will hopefully make the use of flash obsolete. An experimental build of Opera 10 with <video> support was released from Opera Labs a while back, however, they appear to have been slacking in this particular developmental area and Opera 10 is (as far as I know) planned to be released with the lack of support for the <video> and <audio> tags.

    This is a terrible move in my opinion. However, Firefox 3.0 was not released with these capabilities and only extended to support them later in Firefox 3.5, so it just might work out if they are added later.

  4. [done] CSS3 Border-Radius Support. You can notice the lack of support for this CSS gem easily from kyleabaker.com. If you compare this page from Opera and Firefox 3+ you will notice that Opera doesn’t render the rounded top corners of the tabs in the header like Firefox does.

    This is a simple CSS3 feature, but it’s also one of the most noticeably lacking CSS3 features in Opera to date. It’s CSS3 candy like this that many developers are anxious to start using and it’s a shame that Opera hasn’t even offered a browser specific border-radius attribute as Webkit and Firefox have done.

  5. Bug Squashing Session. The last, but probably most important wishlist item is that Opera takes a break from implementing new features and puts some extreme focus into squashing every last bug in the database. While I know that this isn’t feasible, I do believe that a great deal of priority could be placed on this and then some of the lower priority bugs could finally get some attention.

    It seems that Opera is continuously releasing new features one after another. While this is great in one respect, it is also very troublesome in another. We all want to see breaking edge technology and sweet new features, right? But, at what cost are we getting these sweet new features?

    When Opera’s built-in source viewer was released, I remember finding it to be one of the most useful features in the browser for web development. I could easily make changes to a page and view them immediately without any need for uploading and refreshing the page!

    Now, one of the most limiting features of this source viewer that I’ve found is the lack of line numbers. Something this simple was filled as a bug some 2 years ago (plus or minus) and has yet to be fixed. This is obviously a low priority bug, but a bug squashing session that eliminated the nastiest bugs, allowing time to working on these easier bugs would be great!

[done] One bonus wishlist request is for Opera to hurry up and release the next ECMAscript/Javascript engine called Carakan as soon as possible so Opera shows up better in all of these (unrealistic) benchmarking tests. It would be great if Opera 10 were released with all of these wishlist items, but it’s generally not a good idea to rush the release of anything. So it looks like I’ll have to patiently wait for these requests to make their way into my favorite browser.

In case you were wondering, the current version of the ECMAscript/Javascript engine in Opera is code named Futhark and was released with Opera 9.5. Prior to that, the engine named Linear B was used Opera 7.x to 9.2x. Even before that, Linear A was used from Opera 4.x to 6.x. There was no name given to the engine used (if any) prior to that. Comparing them all, I would have to say that Carakan definitely sounds the most impressive. If wish, you can learn more about Opera’s history.

If you have any ideas for an Opera wishlist, post them in the comments or post a link to your blog article about them!