Facebook like button document.domain issue

今天遇到了一個 facebook like button 的問題,錯誤訊息如下

Blocked a frame with origin "https://www.facebook.com" from accessing a frame with origin "https://platform.twitter.com". The frame requesting access set "document.domain" to "facebook.com", the frame being accessed set it to "twitter.com". Both must set "document.domain" to the same value to allow access. l5vDWYcNnY2.js:41
2
Blocked a frame with origin "https://www.facebook.com" from accessing a frame with origin "https://apis.google.com". The frame requesting access set "document.domain" to "facebook.com", but the frame being accessed did not. Both must set "document.domain" to the same value to allow access. l5vDWYcNnY2.js:41
2
Blocked a frame with origin "https://www.facebook.com" from accessing a frame with origin "https://accounts.google.com". The frame requesting access set "document.domain" to "facebook.com", but the frame being accessed did not. Both must set "document.domain" to the same value to allow access. l5vDWYcNnY2.js:41

以及跳出(下圖) popup 然後怎麼點 "Post to facebook" 都沒辦法順利送出(成功送出 popup 會關閉)




當下看到這錯誤訊息只想到兩個可能性
1. https
2. 可能跟其他家( twitter, google+ )按鈕衝突

twitter, google+ 都可以正常的運作,唯獨 facebook 在按下 like 後跳出的 popup dialog 無法順利送出,經過 Google 大神的協助後發現案情並不單純,like button 是使用 facebook 所提供的 html5 版本,內容沒做任何修改,理論上 facebook 發生這種問題的機率肯定比我低,經過許久的查詢發現了 Facebook Debugger,顯示內容如下

其中中間那段為:There was an error in fetching the object at URL 'http://***************************/', or one of the the URLs specified via a redirect or the 'og:url' property including one of http://*********************.


Debugger 很清楚的寫出 og:url 連結是不是有錯?請再確認,因為 og:url 要連的頁面不但 redirect 到另一個頁面,並且由 https 變為 http ,facebook 認為是有問題(就甘心)

結論(廢話結束...)
需要使用 Like button 時可在產生 Like button 的頁面先行測試看是否可以正常使用(把 URL 先帶入試試看),如果不行請先到 Facebook Debugger 查看問題點在哪


相關連結
Facebook Debugger
Facebook like button

沒有留言:

張貼留言