XMLSerializer for Internet Explorer

While trying to convert a jQuery element object into a string, I noticed that all the major browsers support “XMLSerializer”, which does precisely that task. Of course, Internet Explorer is the exception. However, IE does offer the “outerHTML” property on DOM elements, which seems to do the same thing.

I herewith present an extremely short JavaScript snippet which allows global use of XMLSerializer

if (!window["XMLSerializer"]) {
    
    window.XMLSerializer = function() {
        
        this.serializeToString = function(element) {
            return element.outerHTML;
        }
        
    }
    
}

IE Sucks – Deal With It

I’m so tired of Microsoft fan-boys trying to claim that IE isn’t as crap as everyone else with a brain keeps saying. Their typical rhetoric is that IE can do everything the other browser can do, just using a “hack”.

Well, this would be the crux of my problem with it – why the hell must everything be a hack? And for the record, the hacks don’t work right.

Here’s an example – background gradients. All the major browsers (including mobile browsers) all support some fort of native background gradients. IE doesn’t have anything like that. BUT WAIT! Microsoft fan-boys will point to the all-powerful “filter” CSS property. Yeah, great, here’s the problem – the minute you run anything through Microsoft’s “filter” rubbish, all the text loses anti-aliasing. And believe me – it’s noticeable. I actually had one of my most unobservant, tech-unsavvy (not a real word, I know) customers complain that the text “looked like shit”.

And he was right.

So, really – until you can write a website which looks perfect under IE without hacks (and without having to always fall back in static images everywhere), fan-boys should just shut the heck up and accept that Internet Explorer is a massive, steamy pile of rat-turds.

And as for customers – given the ease with which other browsers can now be downloaded and installed, there’s absolutely no excuse any more for using it. If your IT guy says there’s no reason to switch, then you need a new IT guy, because you’re currently working with a monkey.

Don’t Use JavaScript To Detect Browser

Just a word of warning – if you need to check for a specific version of Internet Explorer, do not rely on JavaScript. While working on a project where I was applying JavaScript to customize a closed-source package (yes, we were allowed to do this by the provider), we wanted to make sure that users were using only IE8 and up.

Fairly simple, right?

Well, no. It seems the package we were using was putting IE9 into quirks mode, which (much to my surprise) causes the user agent string to report the browser as IE7.

So, no JavaScript to detect the browser version.

On the server-side, the user agent was coming through correctly, so at least we had a different avenue on which we could proceed, but it seems rather peculiar that there would be no way to correctly identify a browser because of how it is rendering the page.