Showing posts with label ie. Show all posts
Showing posts with label ie. Show all posts

Tuesday, January 19, 2010

Stop the IE6 Hate

For a long time now, it has been common for developers to go on and on about how they hate IE6 and how users needed to be discouraged from using. It's gotten old. It's trite. It's time to move on. 

IE6 has become a non-factor for most sites. It trails far behind IE7 and IE8, not to mention Firefox. And of course, its numbers are always shrinking. I know that at a certain popular website that I happen to work for, we no longer test for IE6. It's been that way for us for 6+ months. It's over.

So now that it's over, there are some things that I want to see. First, I want to see all of those JavaScript libraries that everyone uses, drop their IE6 code branches. Shouldn't jQuery, Prototype, ExtJS, Dojo, etc. all be able to shave off a huge amount of their code? Shouldn't these libraries now progress even faster since they don't have to worry about IE6? Similarly, GWT and similar libraries should benefit as well. Websites should be able to remove some CSS hacks as well, though not all of them... 

Next, I want to see the same passionate disdain directed towards IE7. Now IE7 is not the bug ridden beast that IE6 was. Instead, IE7 is basically a properly patched IE6. As a developer, you would definitely prefer to deal with IE7. It works differently from all other browsers, but it is relatively consistent in the way it works. You could not say this about IE6. However, IE8 is much closer to the rest of the world. If IE7 were to drop off to obscurity like IE6 has done, then imagine the benefits. There would be far less need to write things in a different way for IE. There would be far less need for conditional CSS. 

So stop hating on IE6. Move on. Start taking advantage of a world where IE6 is irrelevant.  And if you still want to hate, start hating on IE7. With a passion.

Thursday, March 06, 2008

IE-Hell Freezing Over

Even after I heard the rumors, I still never thought I'd see it with my own eyes:

My enthusiasm was quickly curbed when I tried to use IE8 to post this blog entry. Not only did the Blogger interface look crazy, but the upload image link did not work. I tried switching to "Emulate IE7". To do that, you must restart the browser. That's not very practical, and just means that most people will have to default to the IE7 emulator. Oh well, I guess Blogger just needs to fix up their non-standard JS? Maybe I will open up a debugger to figure out what is breaking. Probably some kind of browser sniffing code that picks different JS syntax depending on if it is IE or not. Maybe what is needed is an IE8 add-on that fakes the user-agent so that most sites think IE8 surfers are actually Firefox surfers.

Thursday, January 24, 2008

IE Flash Bug

Take a look at this page, and view its source. The key is this little bit o' JavaScript:

function loadSwf(){
window.location.hash ="mark";
var str="<embed src='http://gglabs.com/~clg/flash/YouTube.swf'
type='application/x-shockwave-flash' wmode='transparent' height='800'
width='800'></embed>";
document.getElementById("container").innerHTML = str;
}


What does this do? If you are on IE, then it changes your URL to http://whatever#mark, if http://whatever was your original URL. It then drops a chunk of HTML into the page that embeds a Flash movie. What makes this interesting is if you look at the title. It is not "Test Page" as it should be. Instead it is "Test Page#mark".

This only happens on IE, but on both IE6 and IE7. I'm certain this must be documented somewhere...

Why does this matter? Well it is very common to use hashes to keep track of page history in Ajax apps. For example, in the above app let's say that I write some page initialization code that looks for #mark in the URL. If it finds it, then it goes ahead and loads the SWF. This allows the page to bookmarked and enables browser history (there's actually more you have to do for browser history on IE, but that is another topic.) In this example, we are just loading a page element dynamically, but you can imagine how useful this is for Ajax apps.

So if you are using this technique for managing history/bookmarks and happen to have a SWF on the page, you get crazy page titles. If you think this is a cooked up example, there is actually an example of this "bug" right now on a beta version of a certain high traffic page on the web...

Tuesday, April 10, 2007

JavaScript Benchmarks

Whenever I play with a new computer, one of the things I like to do is run some JavaScript benchmarks (BenchJS.) It's a useful benchmark, since if I'm going to use the computer a lot, chances are that I'll spend a lot of time browsing the web on it. So JavaScript performance will be noticeable to me.

I have two computers at work. The first is a Dell Optiplex. It has a 3.0 GHz Pentium 4 with a 1.5 GB of RAM. I've never had a computer clocked at 3 GHz before. That was near the pinnacle of the NetBurst architecture.

The second computer is an IBM ThinkPad T43p. It has a 2.1 GHz Pentium-M with 2 GB of RAM. Again this was near the pinnacle of the single core Pentium-M's. It has some other nice features, maybe I'll blog about it so more later.

Finally, I recently upgraded my home computer. It's still an AMD 64X2 3800+. I upgraded the RAM to 2 GB. I also upgraded the video card, but I don't think that would matter much for JavaScript performance. I've bought a new hard drive for it, but haven't installed it yet. Again I doubt that would matter. I'm also already bought Vista for it, and will upgrade it soon. Maybe this week, or maybe next weekend, whenever I have time.

Right now, all three computers in question are running Windows XP. I ran Firefox 2.0.03, IE 7, and Opera 9.10. Here are the results:















SetupBrowserTest 1Test 2Test 3Test 4Test 5Test 6Test 7Total


Pentium4-3.0 GHz/1.5 GB RAMFirefox 21.5941.3440.5940.5470.2662.4681.5948.407


Pentium4-3.0 GHz/1.5 GB RAMIE 71.5786.2030.5470.7030.4221.7960.68811.937


Pentium4-3.0 GHz/1.5 GB RAMOpera 91.5631.1560.4380.3120.0782.1560.6416.344


Pentium-M/2.1 GHz/2.0 GB RAMFirefox 21.6720.8440.390.4060.1561.610.7195.797


Pentium-M/2.1 GHz/2.0 GB RAMIE 71.5622.9690.3440.750.4531.3280.6728.078


Pentium-M/2.1 GHz/2.0 GB RAMOpera 91.5620.4370.2820.2650.0631.3280.4224.359


AMD 64X2 3800+/ 2.0 GB RAMFirefox 21.6090.9060.3440.6090.1711.5941.8757.108


AMD 64X2 3800+/ 2.0 GB RAMIE 71.5633.3280.3750.6570.6871.3910.7188.719


AMD 64X2 3800+/ 2.0 GB RAMOpera 91.5630.5160.2970.2810.0781.4220.4694.626















Interesting results! From the browsers, Opera was always faster than Firefox and Firefox was always faster than IE. No surprises here. I was most surprised to see how well the Pentium-M performed. I thought the AMD would beat it out, but it did not. The biggest difference between the two was on the last test. This test calculates the day of the week for Christmas day for the next 1000 years. This test accounted for almost all of the Pentium-M's advantage on each system. I'd be interested to see the JS code for this, but one would think that it would come down to a lot of integer math. So it would make sense that the Pentium-M would have an advantage here. Actually, you gotta wonder why the P4 didn't do better on this test.

Sunday, November 12, 2006

Data Islands

My company's resident JavaScript guru likes to use a technique called Data Islands. While I can roll some JS and have even been known to make asynchronous calls before there buzzwords to describe such a thing, I had never heard of this term until a few months ago.

The idea is simple. You have some server side technology that is serving up data as (drum roll please) XML. This XML is consumed by the client side. If you're doing a lot of AJAX after the initial page load, then you might already have client side assets for reading XML and rendering it in the browser. This technique leverages the same thing, only the XML comes over with the initial load of the page.

So how to embed XML? Well somebody at Microsoft apparently decided it would be great just to have an XML tag in the page and dump it all inside that tag. Hence the term data island.

Surely you see where this is going. The data island is a Microsoft thing and its corresponding implementation via the XML tag is only understood on IE. Still it seems like a technique with some merit, and there are ways to get it to work on Mozilla based browsers, too.

Mozilla will ignore the XML tag as just some unknown HTML tag. However, it will try to show the contents of the tag (and the child tags) so first thing for cross browser support is to give your island an invisible style (style="visibility:hidden".) Next you can slurp up the contents of the tag since it still part of the page DOM. You can pass the contents into a DOM parser, a voila!

A couple problems, though. Mozilla still thinks everything is HTML and "reads" it that way first. So if you have a tag that shares its name with an HTML (or JavaScript) tag/reserved word, you'll have issues. No label or title tags. In fact, even an image tag won't work because of it's use in JavaScript. Similarly, no self closing tags like . If you do it like it won't cause problems, but it will be ignored completely, like it wasn't even there.

That's a lot of baggage to deal with. I investigated some alternatives.
  1. Load the island asynchronously. Chances that the reason you would use the data island technique is that you are also using AJAX for updates to your page, thus you wanted to re-use script written for that XML. In that case, you could just load the data island with a separate AJAX call after the page loads. Obviously the big drawback here is that you have to make a second call to your server to load the page.
  2. Emebed your XML as a JavaScript string instead of an HTML tag. In this case Mozilla won't try to read it as HTML, so it won't give you all the weird things mentioned above. The big drawback is that this is not as efficient on IE, since you aren't making use of the special mechanism, and you have to make sure to make your XML string JavaScript string friendly.
  3. If you're going to go the route in #2, then you might just consider going one step further. Don't use XML at all, and just make your data into a JSON string that is evaluated when your page loads. I didn't do any testing, but this would seem like it has to be pretty close to being as fast on IE as the data island, while still being cross browser. Maybe I'll put that hypothesis to the test. Obviously the big drawback is that you'll want all your client-server communication to use the same mechanism, so you don't have redundant code. Thus you'll probably want to use JSON for your AJAX calls.
I'm kind of partial to #3, which is probably the biggest mutation of the data island technique. I can hear a lot of people saying "well you shouldn't try to make use of an MS extension to HTML anyways..." Don't forget that XMLHttpRequest was once an IE-only extension from MS, but became a "standard" that is now the cornerstone of so many web applications. The data island technique is very complimentary to AJAX, so maybe it will see the same kind of adoption.