指定自定义网址到gplus一键
问题描述:
我有这个代码
<div class="google_button">
<g:plusone size="medium" annotation="none"></g:plusone>
<% case I18n.locale.to_s %>
<% when 'en' %>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<% when 'es'%>
<script type="text/javascript">
window.___gcfg = {lang: 'es'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<% end %>
</div>
我在变量url
中有一个网址:
I have in a variable url
a url:
url = "http://www.mydomain.com/my_custom_url"
我想要将此url变量添加到此google加号按钮.
I want add to this google plus button this url variable.
我该怎么办?
非常感谢!
答
我设法找到开发人员文档.这有点令人困惑,但是您只需要将URL用作<g:plusone>
标记的href属性即可.例如:
I managed to find the developer docs. It's a little confusing, but you just need to put the URL as the href attribute of the <g:plusone>
tag. For instance:
<g:plusone size="medium" annotation="none" href="the url!"></g:plusone>