Usar el servicio Google +1 sin JavaScript

I would like to add a Google +1 icon to a website, but without using JavaScript. Is it possible? Is there some URL I can simply link to, to make it work?

preguntado el 28 de agosto de 11 a las 02:08

4 Respuestas

Google now supports sharing via a static URL:

https://plus.google.com/share?url=URLHERE

More information there: https://developers.google.com/+/plugins/share/#sharelink

Respondido 10 ago 12, 12:08

There is a feature request you can comment on to show your support: https://code.google.com/p/google-plus-platform/issues/detail?id=50

In the meantime, since there is no +1 button fallback when javascript is disabled, Google feels that tracking users is more important than not having people be able to share stuff via their service.

Either use Edy Freddy's nice hack to alleviate the privacy concerns, or take your cue from the +1 fallback to nothing when javascript is disabled. Skip implementing Google+ until they implement this. -Steve

respondido 15 nov., 11:19

I don't think so. The part behind delivered by Google is some JavaScript. Maybe you can analyze the JavaScript and extract something like a link from it, but they wouldn't promote, because they would loose the opportunity to track the users of the websites with +1 buttons on. Another reason why there might be no solution without JavaScript is, that the special functionalities bound to the session of logged in Google users will get lost.

But I have a nice solution for you that I found a few days ago on the web. It helps the visitors of your website to keep their privacy and not to be tracked by Google in an unwanted way, when you put the +1 button on your website.

Put the button of your choice on your own domain and implement this alternative JavaScript. It loads the JavaScript from Google only when the users click the +1 button.

Implement the Google +1 button data privacy safe

<script type="text/javascript">
    function loadScript(jssource) {
        var jsnode = document.createElement('script');
        jsnode.setAttribute('type','text/javascript');
        jsnode.setAttribute('src',jssource);
        document.getElementsByTagName('head')[0].appendChild(jsnode);
        document.getElementById('plus1').innerHTML = "";
    }
    var plus1source = "https://apis.google.com/js/plusone.js";
</script>

<a id="plus1" href="javascript:loadScript(plus1source)">
<img width="76" height="24" title="Show Google +1 Button" alt="Show Google +1 Button" src="http://www.yourwebsite.tld/showplusone-2.jpg">
</a>
<g:plusone></g:plusone>

Respondido 29 ago 11, 18:08

Eddy Freddy's answer is an elegant trick, but it doesn't address the question asked.

In some places you just can't have JavaScript no matter how hard you wish for it! Same goes for iFrames and CSS in some cases too. "Where would this happen?", you might well ask; Easy answer: email clients.

It's workable to make a simple static link to post to twitter. Before it actually posts the tweet, you're landed on a page where you're given the opportunity to edit and approve the message as a logged in user first, so what we're looking for is a Google +1 equivalent of this functionality.

It would not be unreasonable to implement this yourself. Add a +1 static link to a page of your own creation that is in an environment where you can run JS etc, and thus the user can be a logged in google user at the time, at which point a second click can confirm the post. This approach only really applies to email clients though - if you're blocked for other reasons (e.g. some security policy that bans JS everywhere), you're still stuffed.

Pretty much the same thing applies to Facebook Like buttons as they behave the same way and impose the same requirements. Twitter seems to be the only site that's thought about this and provides an official JS-free mechanism.

There's no way around the two-click requirement as without it anyone would be able to post as anyone else, which would be silly.

Respondido 03 Oct 11, 01:10

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.