【问题标题】:Google plus share : image and description not coming谷歌加分享:图片和描述不来
【发布时间】:2012-12-22 20:48:37
【问题描述】:

我想在 Google plus 上分享带有图片和描述的链接(来自 chrome 扩展)。

没有 http 基本身份验证也可以正常工作。

即 URL = "https://mysite.com"

但使用 http 基本身份验证,无法加载图片和说明。

即 URL = "https://subdomain.mysite.com"

为了分享,我使用这个:

在头部:

<meta property="og:title" content="My title"/>
<meta property="og:image" content="https://subdomain.mysite.com/my_logo.png"/>
<meta property="og:description" content="descption"/>

使用链接分享:

<a href="https://plus.google.com/share?url=https://subdomain.mysite.com/link" target="_blank">share</a>

有什么问题:

http-basic-authentication, subdomain or anything else ?

【问题讨论】:

    标签: google-chrome-extension subdomain google-plus basic-authentication facebook-opengraph


    【解决方案1】:

    我尝试使用如图所示的子域共享 URL,我没有看到任何问题,我能够看到描述和徽标。

    用于复制的代码。

    ma​​nifest.json

    {
    "name":"Share URL",
    "description":"Share Some Trivial URL",
    "version":"1",
    "manifest_version":2,
    "browser_action":{
    "default_popup":"popup.html"
    }
    }
    

    popup.html

    <html>
    <head>
    </head>
    <body>
    <a href="https://plus.google.com/share?url=http://maps.google.co.in/maps?hl=en&tab=wl" target="_blank">share</a>
    </body>
    </html>
    

    这是你想要达到的目标吗?

    【讨论】:

    • 我只是摆弄它,但它只是显示超链接共享..@SudarShan
    【解决方案2】:

    问题是 http-basic-authentication, 此问题的解决方案:skipped the http-basic-authentication 用于特定控制器(共享 url),下面是代码:

    def http_authenticate
    
      # this line resolved my problem 
      return if ["my_controller"].include? params[:controller]
    
      if Rails.env.staging?
        authenticate_or_request_with_http_basic do |username, password|
          username == "u-name" && password == "pass"
        end
      end
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多