JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Facebook Share Button (Dynamic url) Posted by stoxic on 21 Jan 2013 at 5:13 AM
Greetings

I have been working on a facebook share button for my website for three days now and I am having a hard time to get it work.

I tried several things and I think I am close. Below, I post the code I use. If you thing you understand what my error is please let me know. Also I have posted a screenshot of the share window in which the meta information is missing.

On the image you can see that the meta tags are not presented. e.g the title, description, etc.

The code :

In BODY
  <!-- Facebook Share Button Functionaliy -->
  <script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>
  <!-- / -->


I also included JavaScript SDK

<!-- JavaScript SDK - Facebook Integration -->
<div id="fb-root"></div>
<script>    (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#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));
</script>
<!-- / -->


And also included these meta tags in head

<title>Website Title</title>
  <meta name="description" content="Website" />
  <link rel="image_src" href="http://www.websiteurlpicutre.com" / >

<!-- OpenGraph Facebook Meta Tags -->
  <meta property="og:title" content="Webiste Title />
  <meta property="og:type" content="website" />
  <meta property="og:url" content="http://www.webiste.com/" />
  <meta property="og:image" content="http://imageurl.com" />
  <meta property="og:site_name" content="Website Name " />


* Note that meta tags have been changed for posting this into the forum

The output is:


If you have any idea what the problem is please let me know.


Thanks for reading.
Thread Tree
stoxic Facebook Share Button (Dynamic url) on 21 Jan 2013 at 5:13 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.