推文到FACEBOOK
<meta name="description" content="網站摘要內容" />
<link rel="image_src" type="image/jpeg"
href="推文指定片路徑" />
<link rel="audio_src" type="audio/mpeg"
href="推文指定聲音路徑" />
<link rel="video_src" type="application/x-shockwave-flash"
href="推文指定路徑" />
參考來源:http://www.niallkennedy.com/blog/2009/03/enhanced-social-share.html
今天在製作活動網站,進行到推文至FACEBOOK的功能製作,推文的網址為http://xxx/B.html,所以預計在FACEBOOK上出現的圖片為B.jpg,但卻一直出現原來網站http://yyy/中的圖片,http://yyy/,是這個活動網站原來版本。
檢查所有路徑,確定已經沒有路徑是指向http://yyy/,但卻還是一直出現舊的圖片,清空所有瀏覽資料後,還是得到相同的結果,猜想FACEBOOK會暫存第一次推文時,所使用的資料,但雖然圖片是原來網站的,但網站摘要內容卻是新的,試了幾次後,都還是一樣,就只推文的網址更變為http://xxx/A.html,就得到我想要結果。
推文到Plurk
<a href="javascript: void(window.open('http://www.plurk.com/?qualifier=shares&status=' .concat('http://xxx/A.html') .concat(' ') .concat('(') .concat('網站的Title') .concat(')')));">
上次這段是有問題的,因為在推文至Plurk會變成
http://xxx/A.html (亂碼
所以應該修改為這樣
<a href="javascript: void(window.open('http://www.plurk.com/?qualifier=shares&status=' .concat('http://xxx/A.html') .concat(' ') .concat('(') .concat(encodeURIComponent(document.title)) .concat(')')));">
另外要說明的是.concat('http://xxx/A.html'),因為在內容中沒有使用到中文參數,所以直接填入網址,但如果有使用到中文,就要修改為
.concat(encodeURIComponent('http://xxx/A.html?value=中文'))
(是左括號
)是右括號