Foros del Web » Programando para Internet » Javascript »

clik en boton, "Me gusta" para mostrar contenido

Estas en el tema de clik en boton, "Me gusta" para mostrar contenido en el foro de Javascript en Foros del Web. foreros necesito una ayuda, lo que necesito es que en mi pagina web muestro un enlace o contenido si el usuario le da clik en ...
  #1 (permalink)  
Antiguo 13/05/2013, 17:36
 
Fecha de Ingreso: octubre-2012
Mensajes: 14
Antigüedad: 11 años, 6 meses
Puntos: 0
clik en boton, "Me gusta" para mostrar contenido

foreros necesito una ayuda, lo que necesito es que en mi pagina web muestro un enlace o contenido si el usuario le da clik en el boton "Me gusta de Facebook... tengo este codigo que funciona casi perfecto...el unico problema, es que si el usuario ha iniciado secion en otra pestaña, en codigo solo dice error, a diferencia d que si el usuario este conectado, le pide iniciar sesion a asi funciona correctamente...porfavor una ayuda, o si tinen potro codigo


Para usarlo, solo copia el código que esta entre las etiquetas <body> en su sitio Web. Modifica poniendo la URL del archivo de descarga en la linea 13, en la linea 56 pones el texto que llevara el Tweet, en la linea 61 pones la URL de Google Plus para el +1 y en la linea 65 pones la URL de tu página de Facebook.

<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Pay with a Tweet, Facebook Like or Google +1</title>
/* Social Payments by Digital Inspiration (2013) */
/* You are free to use, modify or republish this code */
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">

function labnol() {
// The file URL that visitors can download after their Like/tweet/+1
var url = "http://www.labnol.org/";
url = "<a href='" + url + "'>Click here</a> to download the file.";
document.getElementById("restricted").innerHTML = url;
}

window.fbAsyncInit = function() {
FB.init({ status : true, cookie : true, xfbml : true });
FB.Event.subscribe('edge.create', function(response) { labnol(); });
};

(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

window.twttr = (function (d,s,id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
}(document, "script", "twitter-wjs"));

twttr.ready(function (twttr) {
twttr.events.bind('tweet', function(event) {
labnol();
});
});

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

<div id="restricted">

// Add the default text of the tweet and your Twitter handle
<a href="https://twitter.com/share"
data-text="Digital Inspiration is my favorite how-to blog http://labnol.org"
data-via="labnol" class="twitter-share-button" data-lang="en"></a>

// The URL of the page that visitor need to +1 on Google Plus
<g:plusone size="medium" callback="labnol"
href="http://www.labnol.org/"></g:plusone>

// The full URL of your Facebook Page goes here
<fb:like href="http://www.facebook.com/digital.inspiration" send="false"
layout="button_count" width="220" show_faces="false"></fb:like>

</div>
</body>
</html>

Última edición por esdras25; 13/05/2013 a las 17:49

Etiquetas: boton, contenido, funcion, gusta, html, js
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:32.