Mercurial > rlmcintyre
annotate BoosterPack/logintets/.svn/text-base/xml_http_request.js.svn-base @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
rev | line source |
---|---|
rlm@0 | 1 // method that sets up a cross-browser XMLHttpRequest object |
rlm@0 | 2 function getHTTPObject() { |
rlm@0 | 3 var http_object; |
rlm@0 | 4 |
rlm@0 | 5 // MSIE Proprietary method |
rlm@0 | 6 |
rlm@0 | 7 /*@cc_on |
rlm@0 | 8 @if (@_jscript_version >= 5) |
rlm@0 | 9 try { |
rlm@0 | 10 http_object = new ActiveXObject("Msxml2.XMLHTTP"); |
rlm@0 | 11 } |
rlm@0 | 12 catch (e) { |
rlm@0 | 13 try { |
rlm@0 | 14 http_object = new ActiveXObject("Microsoft.XMLHTTP"); |
rlm@0 | 15 } |
rlm@0 | 16 catch (E) { |
rlm@0 | 17 http_object = false; |
rlm@0 | 18 } |
rlm@0 | 19 } |
rlm@0 | 20 @else |
rlm@0 | 21 xmlhttp = http_object; |
rlm@0 | 22 @end @*/ |
rlm@0 | 23 |
rlm@0 | 24 |
rlm@0 | 25 // Mozilla and others method |
rlm@0 | 26 |
rlm@0 | 27 if (!http_object && typeof XMLHttpRequest != 'undefined') { |
rlm@0 | 28 try { |
rlm@0 | 29 http_object = new XMLHttpRequest(); |
rlm@0 | 30 } |
rlm@0 | 31 catch (e) { |
rlm@0 | 32 http_object = false; |
rlm@0 | 33 } |
rlm@0 | 34 } |
rlm@0 | 35 |
rlm@0 | 36 return http_object; |
rlm@0 | 37 } |