*페이스북 공유하기


a링크에 ( http://www.facebook.com/sharer/sharer.php?u=공유할링크 ) 넣어주면 됨. 

공유시 들어갈 요약정보는 메타 태그에서 설정할수 있음.


ex)

-html

<meta property="og:type" content="website" />

<meta property="og:title" content="제목" />

<meta property="og:url" content="사이트 url" />

<meta property="og:description" content="내용 설명" />

<meta property="og:image" content="이미지 경로" />


<a href="javascript:shareFB();" class="fb" title="facebook 공유">facebook</a>


-script

function shareFB()

{

   window.open('http://www.facebook.com/sharer/sharer.php?u=사이트 url');

}


*** 메타태그에 설정한 내용이 잘못되어 수정하여도 수정된 내용이 페이스북 공유 기능에서 바로 적용되지 않을 수 있다.

이때 공유 디버거 (https://developers.facebook.com/tools/debug/) 에 접속하여 해당 페이지를 다시 디버깅하면 바로 적용이 된다.

'퍼블리싱 > HTML&CSS' 카테고리의 다른 글

CSS 단위 em과 rem  (0) 2018.06.11
안드로이드 킷캣 4.4.2 웹뷰 css  (0) 2018.06.07
CSS 디바이스별 미디어 쿼리  (0) 2018.03.15
CSS 인쇄화면 설정  (0) 2018.03.14
CSS 간단한 도넛 차트  (0) 2018.02.09

+ Recent posts