指定自定义网址到gplus一键 [英] specify custom url to gplus one button
本文介绍了指定自定义网址到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>
这篇关于指定自定义网址到gplus一键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文