Twitter share button not sharing the URL, even if i pass it with data-url


#1

Hello!

I am trying t add a twitter share button on my website. I have tried like this:

<a href="https://twitter.com/share" class="twitter-share-button" data-lang="es" data-size="large" data-count="none" data-url="http://localhost/pruebasmarty/Controlador/ServicioDetalle.php">Twittear</a>

<script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>

But the URL is not showing when the twitter widow is open, its just empty. Ive tried with

 <a href="https://twitter.com/share" class="twitter-share-button" data-lang="es" data-size="large" data-count="none" >Twittear</a>

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

But its the same. Can anybody help me?


#2

The link is not displayed because it’s a local URL (the domain name being localhost).
If you change data-url to a non-localhost URL it should work.


#3