XML http object cross browser
I believe this will be useful for everyone who wants to implement AJAX manually and make it compatible cross browser.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | <script type="text/javascript"> // cross-browser method to retrieve an XMLHttp object for asynchronous requests & responses function GetHTTPRequest() { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType("text/xml"); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } return http_request; } </script> |
Posted: August 29th, 2008 under ASP.NET, Javascript.
Tags: AJAX, http, XML