是否有人知道Google的一键按钮的某些代码可以在使用AJAX刷新的页面上运行?这与Facebook非常简单,但我找不到任何有关Google的文档.
谢谢.
Google +1 按钮生成器意味着我需要<meta itemprop="image">为缩略图指定.
文档页面表示遵循以下顺序:
<img itemprop="image" src="..."></img>
Run Code Online (Sandbox Code Playgroud)<meta property="og:image" content="..."/>
Run Code Online (Sandbox Code Playgroud)三个,甚至是三个,都没有为我工作.
Google Plus共享者忽略了我选择的图像,而是显示不同的图像.
这不是缓存问题,因为我已经更改了子域几次只是为了检查.
它看起来 像谷歌+片段更喜欢较大的正方形图像.
我正在构建一个可扩展的引擎,所以我需要确定需求.
Google+缩略图的最小尺寸是多少?
是否必须是正方形,或者它必须接近正方形?
这是场景:
<g:plusone href="http://www.website.com"></g:plusone>)加载到div.我听说这可能有用:
gapi.plusone.go();
但我不确定.
有任何想法吗?
谢谢
我想在网站上添加Google +1图标,但不使用JavaScript.可能吗?是否有一些我可以简单链接到的URL,以使其工作?
我在我的项目[内置CodeIgniter]中使用了Google Plus按钮.这里我添加了以下代码.
<span id="signinButton">
<span
class="g-signin gooConnect"
data-callback="signinCallback"
data-clientid="my_project_client_id"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/userinfo.email">
</span>
</span>
Run Code Online (Sandbox Code Playgroud)
然后我添加了Google提供的Javascript代码.
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
function signinCallback(authResult) {
if (authResult['access_token']) {
$.ajax({
url:base_url+'index.php/user/getUserProfile',
type:'POST',
data:{'access':authResult['access_token']},
beforeSend : function(){
$("#loadingImageBeforeResult").show('slow');
},
success : function(resp){
$("#loadingImageBeforeResult").hide('slow');
if( resp == 'exist' ){
window.location.href=base_url+'index.php/user/my_deals';
} else {
$('#link_for_geniepage').trigger('click');
}
},
error : function(resp){}
});
} else if (authResult['error']) {
// …Run Code Online (Sandbox Code Playgroud) 我在Android应用中使用Google Plus SDK.在一些罕见的设备上,当我的包含Google Plus按钮的视图膨胀时,我遇到了以下崩溃:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // CRASH HERE
....
}
Run Code Online (Sandbox Code Playgroud)
我的GooglePlus按钮是xml,如下所示:
<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
....
/>
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
...
/>
Run Code Online (Sandbox Code Playgroud)
在日志下面.在解决这个问题的方法上有什么想法吗?
谢谢 !!
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.audioguidia.myweather/com.audioguidia.myweather.MyWeatherActivity}: android.view.InflateException: Binary XML file line #111: Error inflating class com.google.android.gms.plus.PlusOneButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #111: Error …Run Code Online (Sandbox Code Playgroud) eclipse android google-plus-one google-plus google-play-services
我使用下面的代码来查找Google对房产的评价.我想要做的是,我正在对财产进行审查,然后我会将其与该财产的旧审查(在数据库中)进行比较.如果它大于系统的属性,则它会发送电子邮件.
此文件每小时运行一次(作为cron文件),我在Google API中启用结算,因此最大限制为1,50,000.
但由于某种原因,API不会返回确切的评论数.例如:
我为具有4条评论的一个属性运行此文件,但API返回0 2或3次,然后在一段时间后返回4条评论.
我不知道背后的原因.我还注意到,我们可以在Google搜索页面和Google+中查看评论.同样,您可以在多个位置撰写评论,例如在Google+和Google地图中.
并检查评论,我使用谷歌加网址.那么评论是否可能存在,但在另一个领域(如Google搜索页面,但不在Google+中)?
/* call api to get review count of Google */
$url = "https://maps.googleapis.com/maps/api/place/details/json?";
$params = array(
"placeid" => $google_place_id,
"key" => $google_api_key
);
$url .= http_build_query($params);
$resjson = file_get_contents($url);
$msg = $resjson;
Yii::log($msg,'info', 'application');
$resjson = json_decode($resjson,true);
$review_count = $resjson['result']['user_ratings_total']=='' ? 0 : $resjson['result']['user_ratings_total'];
/* If review is greater than 0 then check old review and if it's not same then send email */
if($review_count>0)
{
if(sizeof($ressql)>0)
{
/* if google plus …Run Code Online (Sandbox Code Playgroud) 我正在按照本教程https://developers.google.com/+/mobile/android/recommend在我的应用中集成+1按钮.
一旦我将此代码放入xml中,我就会在GraphicalLayout中出现错误
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
plus:size="standard"
plus:annotation="inline" />
Run Code Online (Sandbox Code Playgroud)
我也试过放入xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"父RelativeLayout,但同样的错误.
The following classes could not be instantiated:
- com.google.android.gms.plus.PlusOneButton (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
java.lang.NullPointerException
at com.google.android.gms.plus.PlusOneDummyView$zzb.isValid( at com.google.android.gms.plus.PlusOneDummyView.zzrJ( at com.google.android.gms.plus.PlusOneDummyView.<init>( at com.google.android.gms.plus.internal.zzg.zza( at com.google.android.gms.plus.PlusOneButton.zzN( at com.google.android.gms.plus.PlusOneButton.<init>( at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:438)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:190)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
Run Code Online (Sandbox Code Playgroud)
救命 …
android android-layout android-xml google-plus-one google-play-services
是否有任何方法可以动态添加Google + +1按钮?我需要这个,因为一个页面有许多URL要分享,他们是通过AJAX获得的.所以,当我需要URL时,我想在页面的某些位置生成"+1"-s.
我编写的测试代码适用于IE8以外的所有浏览器(谷歌根本不支持IE7):
<div class="googlePlusBtn"></div>
<a href="#" class="addGooglePlus">Click me!</a>
Run Code Online (Sandbox Code Playgroud)
<script type="text/javascript">
jQuery(function(){
jQuery('.googlePlusBtn').html('<g:plusone annotation="inline"></g:plusone>');
jQuery('a.addGooglePlus').click(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);
return false;
})
})
</script>
Run Code Online (Sandbox Code Playgroud)
请你帮助我好吗?
UPD:固定.解决方案如下:
<div id="googlePlusBtn"></div>
<a href="#" class="addGooglePlus">Click me!</a>
Run Code Online (Sandbox Code Playgroud)
<script type="text/javascript">
jQuery(function(){
var po = document.createElement('g:plusone');
var s = document.getElementById('googlePlusBtn');
s.appendChild(po);
jQuery('a.addGooglePlus').click(function()
{
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = …Run Code Online (Sandbox Code Playgroud) 在此链接中,我学会了为Google +1按钮指定网址.
我还可以指定特定图像吗?
编辑
我不需要更改Google plus按钮gif或Google plus按钮的背景.我需要指定用户想要在社交网络中共享的图像.
有可能吗?
google-plus-one ×10
google-plus ×5
javascript ×4
jquery ×3
ajax ×2
android ×2
html ×2
android-xml ×1
codeigniter ×1
css ×1
eclipse ×1
google-login ×1
meta-tags ×1
opengraph ×1
php ×1
schema.org ×1