سؤال

From what I gather from the Google machine, it seems unless I'm concerned about IE6 and under users, I no longer need to do a try and catch for XMLHttpRequests.

Just wondering as I'm currently reading Headfirst Ajax which was published in 2008 and their forums are dead.

Cheers

هل كانت مفيدة؟

المحلول

According to MDN.XMLHttpRequest#Browser_Compatibility, the basic support is available on Chrome, Firefox, Opera, Webkit (Safari) 1.2+, and Internet Explorer 7+. IE 5 and 6 only support the ActiveXObject method.

So, the answer is No: If you are not planning to support IE 6, you can directly use XMLHttpRequest without the try/catch mechanism for falling back to the ActiveXObject.

However, I suggest using a library that hides all AJAX logic, jQuery.ajax for example.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top