We have an application that utilizes the facebook javascript sdk and login capabilities.
We've been noticing this error come up in our production logs. Specifically for iOS devices with versions 10.3 and higher. Also seems to only be targeting safari browsers
SecurityError (DOM Exception 18): Blocked a frame with origin "https://www.mymadeupsite.com" from accessing a frame with origin "https://staticxx.facebook.com". The frame being accessed set "document.domain" to "facebook.com", but the frame requesting access did not. Both must set "document.domain" to the same value to allow access.
Here is our init function:
init: function(options) {
var facebookUrl, scriptInclude;
Facebook.baseHost = options.baseHost;
if (typeof FB !== "undefined" && FB !== null) {
return Facebook.setup();
} else {
if (options.appId == null) {
throw 'Facebook: cannot init without appId';
}
window.fbAsyncInit = function() {
FB.init({
appId: options.appId,
version : 'v2.3',
channelUrl: options.channelUrl || ("" + document.location.protocol + "//" + document.location.host + "/channel.html"),
status: true,
cookie: false,
xfbml: false,
oauth: true
});
return Facebook.setup();
};
$('body').append('<div id="fb-root"></div>');
facebookUrl = "//connect.facebook.net/" + (Facebook.getLocaleFacebookSupports(Social.SETTINGS.fbLocale)) + "/sdk.js";
scriptInclude = "<script type=\"text/javascript\" async=\"true\" src=\"" + facebookUrl + "\"></script>";
return $('#fb-root').append(scriptInclude);
}
}
My question, why are we only getting this error on iOS devices and versions 10.3?