Aria Stewart (aredridel) wrote,
Aria Stewart
aredridel

Internet Explorer Fix-ups

I see a lot of XMLHttpRequest code that makes a function that handles the request differently for each implementation. Instead, why not just make Internet Explorer behave like the rest? Like so:

if(!window.XMLHttpRequest) { try { var t = new ActiveXObject('Microsoft.XMLHTTP'); XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP'); } } catch(e) { var t = new ActiveXObject('Msxml2.XMLHTTP'); XMLHttpRequest = function() { return new ActiveXObject('Msxml2.XMLHTTP'); } } }

If anyone can think of a more kosher way to see which ActiveX objects are instantiable, I'd love to see it, but this code isn't too inefficient, and you can just write code for the four good browsers and pretend the fifth, evil browser is the same.

Subscribe

  • (no subject)

    You do occasionally visit Boston Public Library, yes? If not, get on it! You were raised in and on libraries. They are in your blood! You…

  • (no subject)

    "I had never been in a room of people who were going to say 'yes' to me before." My friend and I crammed into a rush hour crowded train…

  • Recipe: Storm in the Garden

    Recipe: Storm in the Garden Ingredients 10 ml lavender vodka 10 ml orange vodka 10 ml hibiscus vodka 200 ml ginger ale ice…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments