0

Why Twitter share code not show url in share dialog ?

On my server, load page test.php then click on link (twitter logo) On twitter share dialog it's will show only text : My Text Why not show URL ? But when i test code online at:

http://www.htmlgoodies.com/introduction/about/article.php/3894201/New-on-HTMLGoodies-Test-Your-HTML.htm

It's will show text include URL. Why on my server not show URL? How can i do that ?

This is my code test.php

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.1.js"></script>
<script type="text/javascript">
$(window).load(function(){
  $('.popup').click(function(event) {
    var width  = 575,
        height = 400,
        left   = ($(window).width()  - width)  / 2,
        top    = ($(window).height() - height) / 2,
        url    = this.href,
        opts   = 'status=1' +
                 ',width='  + width  +
                 ',height=' + height +
                 ',top='    + top    +
                 ',left='   + left;

    window.open(url, 'twitter', opts);
    return false;
  });
});
</script>
</head>
<body>
<a class="twitter-share-button shareButton twitter popup" href="http://twitter.com/share?text=My Text" data-text="My Text" data-count="none" data-url="https://www.stackoverflow.com">
<img src="http://i.imgur.com/ywWtzx8.png" alt="">
</a> 
</body>
</html>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Robert Down
  • 147
  • 1
  • 1
  • 7
  • 1
    There's nothing wrong with this. and you've no "php" in that code, so why `.php`? `.html` will do just fine. Besides the *"Use of getPreventDefault() is deprecated. Use defaultPrevented instead."* in the developer console, that should work. Try a new/current version of jQuery. – Funk Forty Niner Oct 17 '16 at 13:57
  • By the way, you say "your server", as in your local PC or a hosted site? If local, how are you accessing this as, `http://localhost` or as `file:///`? Two diffrerent animals here. You going to respond to comments or should I just leave the question? I won't stand around all day here, would you if you were in my shoes? Well, there you go ;-) If you left the question, then I can't post an answer for you to later consult, because the answer(s) is/are in comments. – Funk Forty Niner Oct 17 '16 at 14:04
  • @ Fred -ii- i use hosting site. – Robert Down Oct 17 '16 at 14:45

0 Answers0