Created
November 5, 2014 15:11
-
-
Save andreban/2f249ff1f9b45f2c5300 to your computer and use it in GitHub Desktop.
Creating a CORS Request that Works on IE 8 and IE 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createCORSRequest(method, url){ | |
var xhr = new XMLHttpRequest(); | |
if ("withCredentials" in xhr){ | |
xhr.open(method, url, true); | |
} else if (typeof XDomainRequest != "undefined"){ | |
xhr = new XDomainRequest(); | |
xhr.open(method, url); | |
} else { | |
xhr = null; | |
} | |
return xhr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment