Created
June 29, 2012 13:36
-
-
Save vseventer/3017968 to your computer and use it in GitHub Desktop.
Snippet to test whether CORS works properly.
This file contains hidden or 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
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', 'https://baas.kinvey.com/appdata/kidXXXX', true); | |
| xhr.setRequestHeader('Authorization', 'Basic foo:bar'); | |
| // Enable the line below to provide Android support. | |
| //xhr.setRequestHeader('X-Kinvey-Origin', 'http://www.example.com'); | |
| xhr.onload = function() { | |
| console.log("LOADED", this.status, this.responseText); | |
| }; | |
| xhr.onerror = function() { | |
| console.log("ERROR", this.status, this.responseText); | |
| }; | |
| xhr.send(null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment