Facebook,Twitter和Google +1按钮仅使用HTML(无Javascript)
问题描述:
我想知道是否有一种方法来创建Facebook,Twitter和Google +1的分享按钮,仅使用HTML,而无需任何Javascript插入到代码中。
I would like to know if there is a method to create "share" buttons for Facebook, Twitter and Google +1 using only HTML, without any Javascript having to be inserted into the code at any point.
例如,您可以使用下面描述的方法动态创建这些按钮;然而,他们都最终动态加载Javascript,并在幕后创建自己的代码:
For example, you can use the methods described below to create these buttons dynamically; however they all end up loading Javascript dynamically and creating their own code behind the scenes:
- http://developers.facebook.com/docs/reference/plugins/like/
- http://twitter.com/about/resources/buttons
- http://www.google.com/webmasters/+1/button/
- http://developers.facebook.com/docs/reference/plugins/like/
- http://twitter.com/about/resources/buttons
- http://www.google.com/webmasters/+1/button/
答
Twitter
以下链接将注册相应的赞助,推文和+1:
The following links will register the appropriate Likes, Tweets and +1s:
- http://www.facebook.com/sharer .php?u = http://example.com
- http://twitter.com/share?url=http://example.com&text=Description
- https://plusone.google.com/_/+1/confirm?hl=en&url=http:/ /example.com
- http://www.facebook.com/sharer.php?u=http://example.com
- http://twitter.com/share?url=http://example.com&text=Description
- https://plusone.google.com/_/+1/confirm?hl=en&url=http://example.com
这些链接适用于Wordpress:
These links will work for Wordpress:
<a href="http://www.facebook.com/sharer.php?u=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank" title="Share this page on Facebook">Like</a>
<a href="http://twitter.com/share?url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>&text=<?php the_title(); ?>" target="_blank" title="Tweet this page on Twitter">Tweet</a>
Google +1
<a href="https://plusone.google.com/_/+1/confirm?hl=en&url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank" title="Plus one this page on Google">+1</a>