Jump to content

Should I bother with ActiveX Object?


moose-en-a-gant

Recommended Posts

I'm starting to learn Ajax today and I came across this:

 

Old versions of Internet Explorer (IE5 and IE6) uses an ActiveX Object:

variable=new ActiveXObject("Microsoft.XMLHTTP");
 
Do I need to bother? Or should I have an if else statement that tells based on which browser is detected, what httprequest to use?

 

Ahh... spoke too soon

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

Still, does it matter?

Edited by moose-en-a-gant
Link to comment
Share on other sites

  • 2 weeks later...

Don't some people have javascript disabled?

Some might. Whether it's worth your time to code around that is up to you.

 

Curious the pros and cons of ajax vs. javascript

Ajax is Javascript. There's no versus there. If Javascript is unavailable then neither is ajax.

Link to comment
Share on other sites

About the IE6, not sure, I suppose most people are running 11 or higher

HA! HAHA! One could only dream of such a wonderful utopia.

 

But, thankfully, IE6 has very little users now. IE8 is the new IE6.

 

Like maxxd said above, you can use jQuery for its AJAX library, which will make things a lot easier. It abstracts away the browser incompatibility stuff and has some nice shortcut methods. However, if you're only installing jQuery for the sole purpose of using AJAX, well then there are other, smaller libraries that will do the job as well. jQuery is a bit of a beast.

Edited by scootstah
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.