Instantly share code, notes, and snippets.

Embed
What would you like to do?
Firefox で「混在コンテンツ」をブロックする仕様変更に対する対策。http ではなく、https に接続するように変更した。 cf. https://support.mozilla.org/ja/kb/how-does-content-isnt-secure-affect-my-safety
(function(){
var fbPage = function(){
var that = {},
_paths = location.pathname.split('/');
var hasUserName = function(){ return _paths.length == 2; };
var feed = function(id){
var req = new XMLHttpRequest();
req.onload = function () {
location.href = "https://www.facebook.com/feeds/page.php?format=rss20&id=" + id;
};
req.open("GET", "https://graph.facebook.com/" + id);
req.send();
};
var getFeed = function(){
if (hasUserName()){
var req = new XMLHttpRequest();
req.onload = function () {
feed(JSON.parse(this.responseText).id);
};
req.open("GET", "https://graph.facebook.com" + location.pathname);
req.send();
} else {
feed(_paths[3]);
}
};
that.getFeed = getFeed;
return that;
};
var fb = fbPage().getFeed();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment