与Google +分享动态内容图片javascript

Google plus share with dynamic content image javascript

本文关键字:javascript 动态 Google 分享      更新时间:2023-09-26

我需要从我的网站发布评论到google +。我用了一个脚本,它的工作很好文本。但是我还想显示图像

我使用了以下代码:-

(function() {
               var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
               po.src = 'http://apis.google.com/js/client:plusone.js';
               var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
             })();
         var cid = 'My console developer id .apps.googleusercontent.com';
         var options = {
                    contenturl: 'http://www.google.com',
                    contentdeeplinkid: '/pages',
                    clientid: cid,
                    cookiepolicy: 'single_host_origin',
                    prefilltext: 'Hai happy friday<img src="fgdhj"/>',
                    calltoactionurl: 'http://www.google.com'
                  };
                  // Call the render method when appropriate within your app to display
                  // the button.
                  gapi.interactivepost.render('sharePost', options);

如何显示图像?请帮帮我。

可以预填充文本,而不是HTML。您可以将图像插入任何Google+帖子的评论字段,无论是否编程。您可以链接到具有嵌入图像的页面,并且可以为该页面设置schema.org微数据,以建议使用特定的图像。