My React App depends so much on the Facebook Sdk which I initialized using the below code:
export function initFacebookSdk() {
return new Promise(resolve => {
window.fbAsyncInit = function () {
window.FB.init({
appId: facebookAppId,
cookie: true,
xfbml: true,
version: 'v13.0'
});
window.FB.getLoginStatus(({ authResponse }) => {
if (authResponse) {
//Do something
} else {
resolve();
}
}, true);
};
// load facebook sdk script
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});
}
There was no issue at all with the above script on my app for more than 1 year now. Then all of a sudden few mins ago my site stopped loading in production and even on localhost. When I checked my console I saw the following message:
The resource from “https://connect.facebook.net/en_US/sdk.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
This is a script that has been working flawlessly for over 1 year now.
Only for this to come up all of a sudden from no where.
Please, how can I resolve this?
Thanks
Via Active questions tagged javascript - Stack Overflow https://ift.tt/lGtBC26
Comments
Post a Comment