Question

I'm using the html 5 tag to embed the google plus 1 button on my site

<div class="g-plusone" data-size="tall"></div>

It works fine for all pages except when there's a video embedded on the page. I get a generic button error (no good log that I can see in the network traffic) and then the button redirects to : https://support.google.com/plus/answer/1199142?p=plusone_button_error&rd=1

It's all pretty simply setup so I'm having difficulty locking the problem down.


Here's an example of a page on which the error occurs: http://www.trendhunter.com/keynote/enlightening-keynote

Here is an example of a page on which the button appears to work fine: http://www.trendhunter.com/trends/glutinous-fast-foods-mcdonalds-china-offers-the-new-sausage-double-beef-bur

I'm using this script to load in gplus:

(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); })();

I am loading in the html for the button in a .load afterwards, I moved the google plus script to the callback for the .load but it didn't seem to have any effect.

Était-ce utile?

La solution

The button is not rendering because the Google proxy can't reach the page. Because your other button is working, with the href param passed, this means that the page has a bad canonical tag / is somehow blocking the Google+ proxy. To test the page without having to write any HTML, try just sharing the link directly in Google+:

http://www.trendhunter.com/keynote/enlightening-keynote

If done in G+, you will notice that Google+ can't find the page for sharing. In other words, your +1 code is fine, the issue is that your page isn't being discovered by Google+. The quickest/easiest fix this is going to be linking to a page that can be rendered because this is probably a problem on the Google+ side.

A quick look at your noscript tag led me to this link:

http://www.trendhunter.com/keynote/enlightening-keynote?ModPagespeed=noscript

Which DOES render for Google+. Perhaps passing that as your href to the button will fix it!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top