3초기억력

SNS 내보내기. 공유. 페이스북, 트위터, 밴드, 카카오스토리 SNS 에 글 공유 / 내보내기 본문

코딩_javascript

SNS 내보내기. 공유. 페이스북, 트위터, 밴드, 카카오스토리 SNS 에 글 공유 / 내보내기

잠수콩 2015. 6. 2. 15:24
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.



제목 :  SNS 내보내기. 공유. 페이스북, 트위터, 밴드, 카카오스토리 SNS 에 글 공유 / 내보내기


소스 :

 


<script type="text/javascript">
<!--
 //SNS 등 sharer 처리

 function unescapeXml(str){
  str = str.replaceAll("&amp;", "&");
  str = str.replaceAll("&lt;", "<");
  str = str.replaceAll("&gt;", ">");
  str = str.replaceAll("&apos;", "'");
  str = str.replaceAll("&quot;", "\"");
  str = str.replaceAll("&#039;", "'");
  return str;
 }

 function twitter_share(){
  var text = "<%=strShareTitle%>";
  var url = "<%=strShareURI%>";
  var snsUrl = "http://twitter.com/home?status="+encodeURIComponent(text)+" "+ url;
  var popup = window.open(snsUrl, "_snsPopupWindow", "width=500, height=500");
  popup.focus();
 }

 function facebook_share(){
  var text = "<%=strShareTitle%>";
  var url = "<%=strShareURI%>";
  var image = "<%=strShareImg%>"
  var summary = "<%=strShareSubject%>"
  var snsUrl = "http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(text)+"&i="+encodeURIComponent(image);

  var popup= window.open(snsUrl, "_snsPopupWindow", "width=500, height=500");
  popup.focus();
 }

 function kakaostory_share(){

  var title = "<%=strShareTitle%>";
        title = title.substring(0,100);
        title = unescapeXml(title);
        title = title.replace(/\&(amp;)?/ig, ""); // 카스인경우 &amp; 등록시 글자 짤림

  var url = "<%=strShareURI%>";
  var snsUrl = "https://story.kakao.com/share?url="+encodeURIComponent(url);

  var popup= window.open(snsUrl, "_snsPopupWindow", "width=500, height=500");
  popup.focus();
 }

 function band_share(){

  var title = "<%=strShareTitle%>";
  var url = "<%=strShareURI%>";
  var snsUrl = "http://www.band.us/plugin/share?body="+encodeURIComponent(title)+"&route="+encodeURIComponent(url);

  var popup= window.open(snsUrl, "_snsPopupWindow", "width=500, height=500");
  popup.focus();
 }


//-->
</script>


내용 :



예제 소스 파일 :

sns_sharer.html

 


 출처 :  


Comments