-
Ask anyone who knows me personally, and they'll tell you: I admit it freely, I am a dork.
I have done a lot of web programming the last couple of years at work. We've been writing in house software for insurance companies, and some of it is hosted online for the use of Insurance Agents. For years before this, our company wrote Windows software in and for these same tasks and same companies. For all of these years, we have always plainly told our clients :
Windows only. No Macintosh, no Unix (no Linux!). Ironically, I am a fan of Linux (which is essentially a flavor of Unix).
When we made the real transition to writing web programs for these companies, we maintained the same policy:
IE (Internet Explorer) only. No Firefox, Netscape, Safari, Opera, etc. Honestly, we did not (and still don't!) have the time and money to be spending supporting all of these different browsers. Even though IE was by far inferior both then and now (and even though I actively used Opera then and use Firefox now), we went with IE for one simple reason: Market Share. The plain simple fact is: Most people don't care what browser they use. They use the one that came with their computer. That's almost always IE. (Unless they have a Mac., and then they use Safari...) In the case of Insurance Agents, we have a reasonably good chance of 99.99999999% of our possible users all using IE. We may
never have one using something different. That's made especially likely since most of these people have little or no say in what goes on their office computers. They pay people to decide that for them.
Nowadays though, I'm sensing a change. I know that a lot of the "hype" around Firefox and Safari that floats around does not translate into raw usage. However, I also know that both of them (Firefox especially, although Safari users (like Daniel!) will argue this) are very good browsers. They are far superior to IE 6 (the old and by far most popular internet browser), and they are also greatly superior to IE 7, even though it is all polished, secured, and new now. As people are given the option to upgrade to IE 7, there are an increasing number who try
and then switch to Firefox. It's just that good. As a result, I am forced to consider our company's policy concerning browser support.
I am in such a position that I can not dictate that we start supporting multiple browsers without there being a legitimate demand for it. As it stands, some of our older products could not be fixed without substantial rewrites, and we're obviously not about to invest that kind of time into such a thing. Even as we build new products though, it can take a good amount of time to test every page I write, and that can not be deemed worth it by my boss. He has said as much.
So, I have taken to practicing and learning how to write cross browser code on my own. As I learn many of the differences between the way that IE renders pages and Firefox (and everything else!) renders pages, I have learned tricks that help me write them more and more with minimal differences.
Consider the following javascript code:
function MyEvent(e)
{
if (window.event)
e=window.event;
...
}
In each browser that is an "event" object that contains helpful information such as:
What button was pressed? Where is the mouse on the screen? What key is being pressed?
This may be especially helpful if you want to pop up a box on the screen whenever the right mouse button is pressed, etc. However, each browser handles it differently. Firefox passes the object a a parameter. Internet Explorer makes it a part of the global "window" object. So what do you do? Do you write two functions, one for each browser? That's an excessive amount of work!! The solution is write there in that function I posted above. You take an object, "e", as a parameter. In Firefox, this would automatically now equal the event object. Then, after that, you check for the existence of the global event object that IE uses. If it is there, you make "e" equal that object.
I don't wish to bore anyone, but this is just a small example of the type of programing one has to do to support multiple browsers. (btw, I can not take any credit for the above solution. I had to find it on the net...)
Recently, more and more, I have been working on making our products look and function correctly under Firefox whenever I can. Most of the time, the product in question will function 90% correctly in Firefox, but will look funny (a little). Aside from the example above, it's no small matter that different fonts make all sorts of things look funny between the different browsers! It's even worse between different operating systems!!
With our latest project though, I've been very careful every step of the way. We've been basically building the page part of it from scratch, and I've been taking the opportunity to make a few things render right in both Firefox and IE whenever I can. I even have an AJAX search page that is working correctly in both!!
Tonight, I discovered another snag. Luckily, it seems to be easily resolvable, but it's a nuisance more than anything. The cause of this nuisance? Microsoft. In pushing .Net, they have made it "naturally" incompatible with other browsers. This all revolves around something called "Adaptive Rendering."
Adaptive Rendering, conceptually is
great. It works like this: When you write your web page, you might want to place some text on it inside of a
<div> tag. This would allow you to position it on the page in a variety of different ways. In modern browsers, you could also use CSS tags to set the text color, the font, the background color, the borders, etc. This is the way normal people would do it. However, on some older browsers, or maybe on some mobile browsers, this would result in an error if they do not support modern things like CSS. So .Net has a system in place to avoid this. Basically, instead of using a
<div> tag like so:
<div style-"color:red">My Text</div>You would use something like this:
<asp:Label ForeColor="red" id="something" runat="server">My Text</asp:Label>Looks more complicated, eh? The thing is, when the connecting browser receives the content above, .Net
changes it depending on the capabilities of the browser. For Internet Explorer, for example, it would change it to something like this:
<div style-"color:red">My Text</div>For a browser less capable, it would change it to something more like this:
<span><font color="red">My Text</font></span>This would cause them to look almost exactly the same, which is great if you are using an older browser.
However, there are two notable problems:
1.) It can't convert everything, so a lot of the more advanced rendering, even though it is desperately required in order for the page to look and function correctly, simply goes away.
2.) .Net defaults to the method of showing inferior rendered pages unless it has the browser listed in it's "approved" list. Most newer browsers do not appear on this list, even though they are more than capable of rendering the code. Additionally, there's no real support for the list. No one at Microsoft worries about updating it. (Why should Microsoft care, after all? It just means more people would inherently get better looking results from IE, even though IE is inferior...)
Luckily, there is a solution: One can add the newer browsers to the list if one knows how. Of course, this takes a lot of know how. We are fortunate however that a guy named
Rob Eberhardt has taken up this task, and offers his results for free.
So, what the heck am I writing all of this for? To alienate anyone who reads this blog? Nope. Not really. It's mostly because this is a small example of the kind of tactic Microsoft uses to push it's monopoly forward. And, it's an example of the reasons why they have had so much success with it. It makes me angry when I think about it. So, I am slowly working to make all of our present and future products become Firefox compatible. And, I look forward to the day when I can say, "Sorry guys, if you want this to look good, you need to run this in a standards compliant browser like Firefox or Safari. IE doesn't cut it."
Once I turned my back on Internet Explorer, I never looked back.
- Arik Hesseldahl, Forbes.com