I have an app on Facebook that has a function that posts directly to friends’ walls. It runs without any problems in Firefox and Chrome, but refuses to work in IE. This is the only function that won’t run in IE and is also the only function whose target is in a different domain.
function post_friends() {
var ser = $("#wall_form").serialize();
var spl = ser.split("friend%5B%5D=");
var token = $("#access").prop("value");
var youtube = $("#post_youtube").prop("value");
var shati = $("#share_title").prop("value");
for (var i = 0; i < spl.length; i += 1) {
if (spl[i] != "") {
var lps = spl[i].split("&");
var lru = "https://graph.facebook.com/" + lps[0] + "/feed";
var atad = "name=" + shati + "&access_token=" + token;
//as far as I can tell, this is the only part of the code that refuses to run.
var poche = $.post(lru, atad, function(msg) {
hide_black();
});
}
}
}
Is this a domain issue? How do I solve this? Thanks.
Edit:
okay, so it is a domain issue. XDomainRequest is needed, which jQuery doesn’t use.
Edit 2:
problem solved.
IE uses
XDomainRequestwhen performing cross domain requests, which isn’t used by jQuery. Instead of using just$.post, the script now checks first if the browser being used is IE and then acts accordingly: