-
-
Save SunboX/eda03a50d4475a90a103 to your computer and use it in GitHub Desktop.
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
/* | |
YOU'LL BE ABLE TO PERFORM A CROSS DOMAIN REQUEST IF YOUR APP IS CERTIFIED OR PRIVILEDGED. | |
FOR MORE INFO CHECK THE PERMISSIONS MATRIX: https://docs.google.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0 | |
First you'll need to setup the permission for doing the cross domain request on your application manifest. | |
Go to your app manifest, to the permissions section and add the following: | |
"systemXHR": {} | |
Now let's create the xhr object, it needs a special parameter, take a look: | |
*/ | |
var xhr = new XMLHttpRequest({ mozSystem: true }); | |
// Use the xhr object as usual ... | |
// When checking for the result, you'll look for response status 200 OR (AND THIS IS IMPORTANT) 0 | |
xhr.onload = function(e) { | |
if (xhr.status === 200 || xhr.status === 0) { | |
// Do your stuff here | |
} else { | |
// An error happened | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment