facebook|Twitter|linkedin分享

本文全面介绍了从前端HTML、CSS、JavaScript到后端PHP、Java、MySQL的技术要点,同时深入探讨了移动开发、游戏开发、大数据开发等领域的最新趋势与实践。
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
	<meta charset="UTF-8">
	<title>Document</title>

	<!-- facebook、linked参数配置 start -->
	<meta property="og:site_name" content="site name"/>
	<meta property="og:title" content="title"/>
	<meta property="og:type" content="website"/>
	<meta property="og:description" content="description"/>
	<meta property="og:image" content="http://yourdomain.com/images/hatenablog.png"/>
	<meta property="og:url" content="http://yourdomain.com/test.htm">
	<!-- facebook、linked参数配置 end -->
	
	<!-- Twitter参数配置 start -->
	<meta name="twitter:card" content="http://yourdomain.com/images/logo_fb.jpg">
	<meta name="twitter:site" content="@yourdomain">
	<meta name="twitter:title" content="test title">
	<meta name="twitter:description" content="Up than 200 characters.">
	<meta name="twitter:creator" content="@creator_username">
	<meta name="twitter:image:src" content="http://yourdomain.com/images/logo_fb.jpg">
	<meta name="twitter:domain" content="content">
	<!-- Twitter参数配置 end -->

</head>
<body>
	<!-- facebook分享 start -->
	<script>
		function fbs_click(){
			window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent('http://yourdomain.com/test.htm?facebook=123'),'facebook share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return fbs_click()" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Facebook" />
	</a>
	<!-- facebook分享 end -->
	
	<!-- Twitter分享 start -->
	<script>
		function twitter_click(){
			window.open('https://twitter.com/intent/tweet?hashtags=Invitedusers&original_referer=http://yourdomain.com/test.htm&related=domain&text=Content Test&tw_p=tweetbutton&url='+encodeURIComponent('http://yourdomain.com/test.htm?twitter=123')+'&via=ligang','share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return twitter_click()" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Twitter">
	</a>
	<!-- Twitter分享 end -->


	<!-- Linkedin分享 start-->
	<script>
		function linkedin_click(){
			window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent('http://yourdomain/test.htm?linkedin=123')+'&token=&isFramed=false&lang=en_US','Linkedin share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return linkedin_click();" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Linkedin">
	</a>
	<!-- Linkedin分享 end-->


	<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
  	<script type="in/share" data-url="http://tzyourdomain.com/test.htm" data-counter="top"></script>

</body>
</html>

注意问题:
1. facebook和linkedin对于"sample open graph meta tags"的要求格式一样,所以如果同一个页面既要做facebook又要做linkedin,对于图片等信息必须一致
2. linkedin具有七天缓存期限,官方原文“The first time that LinkedIn's crawlers visit a webpage when asked to share content via a URL, the data it finds (Open Graph values or our own analysis) will be cached for a period of approximately 7 days.”

开发文档
facebook:https://developers.facebook.com/docs?locale=zh_CN
Twitter:https://dev.twitter.com/web/embedded-tweets
linked:https://developer.linkedin.com/docs


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

奋飛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值