調べてみるとこれはGianismの問題ではなくFacebookの問題であるらしい。
そしてサーバーサイドでこれを回避するのは難しく、クライアントサイド、即ちブラウザ側でJavaScriptを用いて回避するしかないらしい。
回避するには以下のようなJavaScriptを使用する。引用元はコチラ。
// Facebook OAuth のバグ回避 リダイレクト後URLに「#_=_」が付加される問題を回避するスクリプト
<script type="text/javascript">
if (window.location.hash && window.location.hash == '#_=_') {
if (window.history && history.pushState) {
window.history.pushState("", document.title, window.location.pathname);
} else {
// Prevent scrolling by storing the page's current scroll offset
var scroll = {
top: document.body.scrollTop,
left: document.body.scrollLeft
};
window.location.hash = '';
// Restore the scroll offset, should be flicker free
document.body.scrollTop = scroll.top;
document.body.scrollLeft = scroll.left;
}
}
</script>WordPressのテーマにSimplicityを使用している場合、子テーマの「javascript.js」に上記のスクリプトをコピペすればよい。但しその場合は、冒頭と最後のscriptタグを除去すること。そのままコピペできるように上とほとんど同じであるが、貼り付け用のスクリプトを掲載しておく。
// Simplicity子テーマ貼り付け用
if (window.location.hash && window.location.hash == '#_=_') {
if (window.history && history.pushState) {
window.history.pushState("", document.title, window.location.pathname);
} else {
// Prevent scrolling by storing the page's current scroll offset
var scroll = {
top: document.body.scrollTop,
left: document.body.scrollLeft
};
window.location.hash = '';
// Restore the scroll offset, should be flicker free
document.body.scrollTop = scroll.top;
document.body.scrollLeft = scroll.left;
}
}


コメント