Multi-Tab Template for Facebook Timeline Page Tabs!
Our TURNKEY template has all the code and files to create a website-like Page Tab.
See it in action, and learn more....

Tutorial: Add a Share Button to your iFrame Tab Application

If you’re NOT on the HyperArts Blog, CLICK HERE!

NOTE: Updated 12/7/11 to change JavaScript SDK script to ansynchronous, and various modifications and additions.

As Facebook continues to encourage the move towards iFrame applications rather than FBML ones, one thing that Page Admins have asked about is the ability to have a “Share” button on their Fan Page that allows the user to add a comment and then post a pre-defined text block, image, and link to the Wall and News Feed of friends. In FBML, this was accomplished using the <fb:share-button> tag, but this ability is missing from the Social Plugins that Facebook provides for use on external websites and in iFrame applications.

Replicating the Old Share Button Code with JavaScript SDK & jQuery

In this tutorial, we will look at how to use the Facebook Javascript SDK and some jQuery to mimic the old <fb:share-button> function within iFrame-powered applications that appear on a Fan Page. If you are not familiar with creating an iFrame application, you will want to refer to our tutorial on creating an iFrame tab application first.

NOTE: A basic understanding of JavaScript is required

This tutorial will require that you have at least a basic understanding of JavaScript. If you don’t, you may have difficulty working with the code in this tutorial.

STEP 1: Add code to load the Facebook JavaScript SDK into your HTML/PHP index file

IMPORTANT: In order for this to work with Internet Explorer, you MUST include the <html> </html> and <body> </body> tags in your index page.

First, add to your application index file (usually called index.html or index.php) some code that loads the Facebook JavaScript SDK (between the <body> </body> tags):

<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
 
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>

NOTE: You will need to replace the 'YOUR APP ID' with your actual application ID, which you can find on your application page at facebook.com/developers.

STEP 2: Add code to load the jQuery Library to your App

Next, you need your app to load jQuery, which is a JavaScript library that simplifies many JavaScript-related tasks. You could also use basic JavaScript, or another library such a MooTools, but that is beyond the scope of this tutorial.

I like to load the jQuery library from Google as it loads quickly and many people will already have it cached in their browser history.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>

STEP 3: Add some jQuery and fb.ui code to display the Share dialog box

Now that we have the Facebook JavaScript SDK and jQuery loaded, we are ready to define the Share popup dialog using some jQuery and the Facebook function fb.ui. Insert this code into your file:

<script type="text/javascript">
$(document).ready(function(){
$('#share_button').live('click', function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: 'HyperArts Blog',
link: 'http://hyperarts.com/blog',
picture: 'http://www.hyperarts.com/_img/TabPress-LOGO-Home.png',
caption: 'I love HyperArts tutorials',
description: 'The HyperArts Blog provides tutorials for all things Facebook',
message: ''
});
});
});
</script>

This code tells jQuery to attach a Share dialog to the DIV in your code with the ID of "share_button". You can insert multiple share buttons on a page by repeating this code, making sure you use a unique ID for each (eg #share_button1, #share_button2).

This code will create this dialog:

You can customize the text and image in the Share dialog and post by changing these values:

  • Name: This is the text that appears on the first line of the Share and is hyperlinked to your link;
  • Link: This is the hyperlink that you want to share;
  • Picture: This is the URL of the image that you want displayed along with the post on the Wall/News Feed. I used an image that 70 x 70 in this example, but Facebook appears to allow some flexibility around image size that you are sharing. Just make sure you test out what you image ends up looking like on the feed.
  • Caption: This is the first line of text after the Name/Link;
  • Description: This is the text that appears under the caption. Use it to provide incentive for why users should click on it.
  • Message: This field allows you to pre-populate the message box at the top of the dialog. Facebook normally does not recommend that you pre-populate that field since they want the user to enter a personalized message.

STEP 4: Create a link/button to trigger the dialog

You can launch the the Share dialog using any link or button. In our case, we created a graphic that looks like the classic "Share" button:

Just insert the link/image in your index file and add the ID "share_button"

<img src = "share_button.png" id = "share_button">

When the user clicks on that button, it will cause the Facebook dialog to be displayed.

Once the user fills in their message and clicks the "Publish" button, the post will appear on their Wall and may appear in their friends' News Feeds (depending on their settings).

STEP 5: Control the Cursor Style with CSS

Control Share Button Cursor with CSSTo add a custom cursor to the Share Button with CSS:

 

  • Add this style to your stylesheet:

    img#share_button {cursor: pointer;}

  • Or inline the style on the page:

    <style type="text/css"> img#share_button {cursor: pointer;} </style>

Adding Multiple Share Buttons to a Single Tab

You can do this by replicating the <img /> tag, changing the

id = "share_button"

to

id = "share_button2"

And replicating the JavaScript just below it, changing:

$('#share_button')

to

$('#share_button2')

If you're also implementing the CSS to control the appearance of the cursor (as described above, in Step 5), you need to change:

<style type="text/css"> img#share_button {cursor: pointer;} </style>

to

<style type="text/css"> img#share_button, img#share_button2 {cursor: pointer;} </style>

Obviously, modify IDs for each additional Share Button!

View a live example of our Share Button

You can see an example of this code in action on the HyperArts Examples page. It has two share buttons.

Downloading the code

You can also download the code we used to get you started. Just make sure to update the APP ID, text, and images as needed.

Troubleshooting the Share Button

API Error Code: 191 Popup Dialog

If you get the "API Error Code: 191" popup dialog error:
Facebook API Error Code 191 - Dialog Popup

when using an embedded Share Button or other feature that requires the Facebook JavaScript SDK, it's may be because you haven't specified the "App on Facebook" URLs. Read this for more details.

Please post your questions in the comments section below. Happy coding!

Technorati Tags: , , ,

  • http://www.girishnathaney.com Girish Nathaney

    Hello,

    Thanks for the most needed updates :)

    I was trying to download the code, but could not as i was for username and password! Please advise on this.
    Thanks

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Girish,

      Sorry about that. The code download link should work now.

      Bill

      • http://www.facebook.com/people/Windle-Poons/100000930901227 Windle Poons

        It doesn’t work to change the visibility of a post, if I try to the whole dialog dissapears… :-(

  • Savannah

    Wouldn’t it be easier to just use share.php and send it an encoded URL? Here’s what I use on my pages (I use the easy encoder/decoder at http://meyerweb.com/eric/tools/dencoder/):

    < < Code removed due to display issue >>

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Savannah,

      Sure, there are always multiple ways to accomplish the same task. As far as I know, Facebook doesn’t recommend the direct use of the share.php script and would prefer that everything be accessed through their official SDK’s though.

      Bill

      • http://cleaverwhite.com/Gallery04/ Eric

        Hi Bill. I can’t get any of my comments to take hold here. Hope this works. I have a question: My share button keeps throwing an error on this page:
        http://cleaverwhite.com/Gallery04/
        but not on this one:
        http://cleaverwhite.com/Gallery02/

        Can you see why? I can’t figure it out. Thanks! -Eric

        • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

          HI Eric,

          I think the issue may be that you are loading the Facebook JS file twice (all.js) and you have two “fb_root” DIVS, which might be confusing FB. I would suggest that you change the first reference to <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"&gt; so that it still parses the XFBML tag you are using later, and the remove the second reference “fb-root” div and the second loading of the JS file.

          Bill

  • http://cleaverwhite.com/Gallery04/ Eric

    Okay, I think that’s getting me closer, but now it’s giving me this in the error window:

    API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.

  • http://www.qyzzy.com Vin Lim

    Does the script require “publish_stream” permission?

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Vin,

      No, the script doesn’t require any permissions from the user since it doesn’t publish anything unless they click the Publish button. “publish_stream” is only needed if you are publishing an item to the Wall/News Feed without explicit permission from the user at the time of publishing.

      Bill

      • http://www.qyzzy.com Vin Lim

        Apparently i face “An error occurred. Please try again later.” when one of the user does not have publish_stream permission while another user with permission work just fine.

        You have any idea?

        http://www.facebook.com/qyzzy?sk=app_122367181180949

        • http://www.qyzzy.com Vin Lim

          Hi Bill, is me again. I revoked my own app access and i see “An error occurred. Please try again later.” It seems like it really need publish_stream access

  • Ryan

    Thanks for the post! One question…I ran something similar on a new application page, and tab. The share got a lot of use and it was blocked from sharing by Facebook. Any ideas on this? Would your javascript share run into the same problem with high traffic on a new application/tab?

    Thank you!

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Ryan,

      You would probably run into similar limit issues with this script since it just calls the official Share function built into Facebook. Out of curiously, how many “Shares” were done that caused you to be blocked?

      Bill

  • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

    Vim Lim: As I mentioned, public_steam permission isn’t needed. You can see it working on our example page without that permission. I have seen that error when the JS SDK is loaded more than once, or in the wrong order. One thing that you might try is loading the SDK asynchronously rather than the way that I indicated in this article. Just look for that section with that title in the Facebook developer docs.

  • http://www.qyzzy.com Vin Lim

    Hi Bill,

    Thanks a lot. I got it working at fb.com/qyzzy

    Thanks again. You have been great help!

    • http://carneirodossantos.com.br/majusantos Maria Julia

      hi Vin Lim,
      im having the same problem as you did, how did u make it work???

  • http://www.inspiringjourneys.com.au Peter Rasmussen

    Thanks Hyperarts, great blog

    I am getting the error:

    “Invalid Argument
    Given URL is not allowed by the Application configuration.”

    My App ID is correct and so are the URLs but it still throws this error in all browsers. Any ideas?

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Peter,

      I have that seen that error before, and I seem to recall it had something to do with the Canvas app settings when I set up the FB app, so you might want to double-check those to make sure that page you are loading matches those settings.

      Bill

  • Sean

    Hi Bill,

    I’m using this in a different way, not as a button on a fan page but as a button on my blog that will be link to the fan page.

    It is working great but, is there a way to make the share point to a particular a fan page on facebook?

    thanks.

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Sean,

      You should be able to set the ‘link” property to point to any URL, including a Fan Page URL on Facebook.

      Bill

  • http://www.socialtechnow.com talwinder

    Plz someone help me
    How to Specifiy a different stylesheet for iFrame on Facebook,how can one make Facebook use a specific CSS file when it shows content through the iframe.

    I want to apply a specific stylesheet for the content of an external wordpress site when it is shown in an iframe on Facebook.. When visited directly, the page would call the regular CSS. When seen through the iframe, it would call a facebook-specific CSS.

  • http://scalablesocialmedia.com Alisa

    Hi, I have been looking all over to try to figure this out, thanks for the post! I’m having some trouble getting it to work, and I’m sure it is because I’m using like-gating. My index.php code looks like this:
    <?php

    require 'facebook.php';
    $app_id = "APP ID HERE";
    $app_secret = "APP SECRET HERE";
    $facebook = new Facebook(array(
    'appId' => $app_id,
    'secret' => $app_secret,
    'cookie' => true
    ));

    $signed_request = $facebook->getSignedRequest();

    $page_id = $signed_request["page"]["id"];
    $page_admin = $signed_request["page"]["admin"];
    $like_status = $signed_request["page"]["liked"];
    $country = $signed_request["user"]["country"];
    $locale = $signed_request["user"]["locale"];

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot; type="text/javascript"></script>

    <img id = "share_button" src = "https://app.tabpress.com/fbui_share/share_button.png"&gt;

    if ($like_status) {
    include("index2.php");

    }
    else {
    include("index1.php");
    }

    ?>

    I can’t figure out how to combine the elements from your index.php page and mine (as well as how to put the share on the index1.php and index2.php pages – I tried adding the fb-root div, but while that might be the key, I can’t tell)

    Thanks!

  • http://scalablesocialmedia.com Alisa

    OK, figured it out. My index.php file needed no changes, it was just the index1.php and index2.php files that needed the new code. Thanks again!

    • http://www.hyperarts.com/blog timware

      Glad you sorted it out, Alisa!

      • http://scalablesocialmedia.com Alisa

        Thanks, Tim :)

  • Harry

    Hello,

    I just tried your code by just changing the app id but Facebook is giving me “An error occured. Please try again later.”

    Is anybody getting the same error ?

    Thank you for your help!

    • http://www.hyperarts.com/blog/author/bill-dailey/ Bill Dailey

      Hi Harry,

      I have seen that error before — it was usually tracked down to loading the Facebook Javascript SDK (all.js) more than once on a page, which seems to confuse Facebook. You might check your code to see if you are doing that.

      Bill

      • Harry

        Thank you Bill!

      • Guest

         wow pulling my hair out, thanks !!

  • http://www.qyzzy.com Vin Lim

    Hi Maria Julia,

    I initiate permission request for permission to post to wall.

    HtH

    • http://carneirodossantos.com.br/majusantos Maria Julia

      sorry, is my first time doing a fan page (i dont know absolutly nothing!) … do you know some websites tutorial that teach me doing that???

      when i put the code first time this erro ocurred (saing that i need to try later). im using ifram tab app…

      sorry for the inconvenience

      (and sorry abot the english… im from brazil)

  • chris l

    your own tutorial example doesn’t work even in TabPress-very embarrassing.

    • http://www.hyperarts.com/blog timware

      It works in TabPress, Chris, straight out of the box IF you implement it as directed in this tutorial (to see the working example, you’ll have to “Like” the HyperArts fan page). I simply copied and pasted code in this tutorial into TabPress. Make sure you include the link to the image for your Share Button.

      And don’t be embarrassed about not being able to get it to work. If you work at it, you’ll get it :-)

  • http://www.facebookdeveloperuk.com Sian Mitchell

    Thanks for the tutorial. I had the error message too – but we figured out it was only in IE and was the Compatibility Mode chestnut. We took out the , after the appid in the first script and it all worked like a charm. Hope this helps.

  • Sculley

    Hi Bill, thanks for the article.  I’m a bit confused, though. Where does the code go?  In the header?  Some in the body?  I’m unclear.  Thanks so much!

  • Bob G.

    Bill,
      Sorry but my last paragaaph lost its formatting.  I’d be happy to send that code sample via email.
    Cheers,
    Bob G.

  • http://www.incrediblogger.net Make Money Online

    How to ask permission to post on friends/fans wall through my facebook fanpage?

  • Anonymous

    I’d like to thank you guys for this post. It help me a lot.error codes

  • Anonymous

    I’d like to thank you guys for this post. It help me a lot.error codes

  • Bob G.

    Bill,
      I’m trying to get your Share_button example to work on my hosted (I use Host Monster) Facebook App.   I put your recommended code into my index.php file as shown in CODE EXAMPLE A and the rest of your example into my FB App script as shown in CODE EXAMPLE B.   Note that I’ve substituted my own code to display a button that will call your code.   The scripts all run without error messages but the script in my App, exampe B, doesn’t display anything.  Please take a look and my scripts and let me know what I might be doing wrong.
    CODE EXAMPLE
    A://ADDITION REQUIRED BY FB:SHARE-BUTTON JAVA SCRIPT CODE EXAMPLE – TABPRESS SEE PG.88 8/23/11echo “FB.init({appId : ’138163634856′,});”;echo ” “;
    END CODE EXAMPLE A

    CODE EXMAPE B
    ////TAB PRESS TUTORIAL: ADD A SHARE BUTTON TO YOUR IFRAME TABE APPLICATION JUNE 6, 2011

    $(document).ready(function(){$(‘#share_button’).click(function(e){e.preventDefault();FB.ui({method: ‘feed’,name: ‘HyperArts Blog’,link: ‘http://hyperarts.com/blog’,picture: ‘http://www.hyperarts.com/_img/TabPress-LOGO-Home.png’,caption: ‘I love HyperArts tutorials’,description: ‘The HyperArts Blog provides tutorials for all things Facebook’,message: ”});});});

    END CODE EXAMPLE B

  • Anonymous

    Hi,

    I downloaded the code from here and have set it up on my page. It works fine in all browsers except Internet Explorer. The error that shows is: “An error occured. Please try again later.”

     I have already checked if I am loading the all.js more then once, and it is still showing this error.

    Any idea about what this can be?

    • http://www.hyperarts.com/blog/ Tim Ware

      Try loading the asynchronous version of the JavaScript SDK. It’s on this Facebook Developers page, underi the heading “Loading the SDK Asynchronously.”

      And report back on if it works. Thanks!

  • Pingback: Posten mit JS-SDK FB.ui : feed

  • http://www.facebook.com/people/Yajie-Cai/100002448440087 Yajie Cai

    I can’t download the code why….

    • http://www.hyperarts.com/blog/ Tim Ware

      Please try again. We had changed where files were hosted and I hadn’t changed the links in this post. They’re fixed now. Sorry about that!

  • http://www.hyperarts.com/blog/ Tim Ware

    IMPORTANT: The link URL has to be under the same domain as the page with the Share Button. For example, if your Share Button is hosted at

    http://www.MyDomain.com/share-button.html

    the link it shares must be at MyDomain.com.

    If your Share URL is on a domain/website other than the one where the button is, you’ll get the error message you describe.

    • Adam Taylor

      it’s likely that Ali Hawley (above) is trying to use this method to share a tab on facebook, by implementing this button ON that tab.Sadly, fb:share is the only remaining way to do this, ie:
      Use some CSS to style the “#sharebtn a”, etc.

      This article’s title may mislead some users trying to drive traffic to their FB tabs..

    • http://www.facebook.com/john.rives John Rives

      In a reply to Sean by Bill in a post from five months ago, bill says
      “You should be able to set the ‘link” property to point to any URL, including a Fan Page URL on Facebook.”
      Is this no longer the case? I was able to put the Share button on a Facebook iframe page hosted on a web server and link to the Facebook tab that had the iframe app on it. Now that does not work when I try it again and I get the API Error Code 191. Has Facebook changed thier policy, or is there some other way to do this now? Thanks, JR

      • http://www.hyperarts.com/blog/ Tim Ware

        Make sure that you set up your app with Secure URLs. Remember, your index page for your page tab has to be hosted securely.
        The Error 191 is probably because when you set up your app, you specified your Page Tab URLs, but not App on Facebook URLs. Add the URLs to that, as well, and it should work. Let me know.
        Here’s more on that: http://www.hyperarts.com/blog/tutorial-add-an-iframe-application-to-your-facebook-fan-page-fall-2012/#error191

        • http://www.facebook.com/john.rives John Rives

          Well, you were right, I did not have the App on Facebook URLs set, but I still have a problem. The posts are appearing on my wall instead of on the Facebook page tab with the Share button which is where they need to be. I had this working on another project and when somene made a post, it added it to the tab, which is used as the link in the Javascript code. That is not working now for some reason and I have tested that link and it does go to the tab. Any idea why that part isn’t working? Thanks, JR

        • http://www.hyperarts.com/blog/ Tim Ware

          Glad you got it working. As for Share Button posts appearing on the tab that the button’s on, I can’t help. The default way it works is to post it to your Wall.

  • http://www.hyperarts.com/blog/ Tim Ware

    The picture works for me, Ricardo.

    • http://www.facebook.com/MegaLopes Ricardo Lopes

      I fixed it myself!
      I don’t know why, but does not work with SSL , after I move to http the pic works!!!
      Anyway, I thought it was problem with the script and changed the other hand, now I have to do it again.

      Work –>http://megalopes.com/facebook-apps/logos/thumbnail.jpg
      Not working –> https://www.megalopes.com/facebook-apps/logos/thumbnail.jpg
      www. megalopes is a subdomain

      Thanks for your atention!

      • http://www.hyperarts.com/blog/ Tim Ware

        I can only say that you have to make sure you get an SSL certificate for the specific subdomain you’re using. An SSL certificate for http://www.yourdomain.com WON’T cover mysubdomain.yourdomain.com.

  • http://www.hyperarts.com/blog/ Tim Ware

    The picture works for me, Ricardo.

  • http://www.hyperarts.com/blog/ Tim Ware

    The picture works for me, Ricardo.

  • http://www.facebook.com/people/Snemelc-Bauer/100003135379622 Snemelc Bauer

    “An error occurred with Static HTML: iframe tabs. Please try again later.” ?!
    Whats wrong? thx!

    • http://www.hyperarts.com/blog/ Tim Ware

      You should check with the admins for the Static HTML app.

  • http://www.facebook.com/hays.tome Hays Tome

    how can make the app to publish on user frindes wall autamtic??

    • http://www.hyperarts.com/blog/ Tim Ware

      You can’t. It violates Facebook’s terms of service, and it violates the privacy of users. The user has to want to post on their Wall. It’s up to them, not you.

  • http://www.hyperarts.com/blog/ Tim Ware

    Here’s how to use CSS to add a custom cursor to the Share Button:

    Just add this style to your stylesheet: img#share_button {cursor: pointer;}
    Or inline it on the page:

    <style type=”text/css”> img#share_button {cursor: pointer;} </style>
    I tested with IE 8 and with Firefox on the Mac (Lion) and it works fine.

    • Anonymous

      Thanks Tim that worked!

  • http://www.hyperarts.com/blog/ Tim Ware

    Here’s how to use CSS to add a custom cursor to the Share Button:

    Just add this style to your stylesheet:

    img#share_button {cursor: pointer;}

    Or inline it on the page:

    <style type=”text/css”> img#share_button {cursor: pointer;} </style>

    I tested with IE 8 and with Firefox on the Mac (Lion) and it works fine.

  • Anonymous

    I’m having exactly the same problem so any suggestions would be welcome.

  • http://www.hyperarts.com/blog/ Tim Ware

    Yes, Mike, you can add multiple buttons to the tab.

    In looking over my article, I saw that it needed a number of things updated:

    1) You have to include the <html><body> … </body></html> tags in the index page (for IE!);

    2) You must use the “asynchronous” code for loading the JavaScript SDK.

    I also added a section on how to add multiple Share Buttons to the tab. I tested this with IE, Firefox and Safari, and it worked fine, as long as you change the IDs in the appropriate places.

    Your question resulted in my improving and updating this post, so thanks!

  • Anonymous

    Thanks to your further suggestions and working example I was able to work out where I was going wrong so thank you for taking the trouble expand on your instructions.

    However, using the asynchronous version of code seemed to cause your FB.Canvas.setSize() solution for removing the scrollbars to break in some examples I tried. For me the standard SDK code eventually worked (once I removed my other errors) for the multiple buttons together with your  FB.Canvas.setSize() scrollbar solution

    • http://www.hyperarts.com/blog/ Tim Ware

      Mike, Did you check your tabs with IE 8? That’s the one that caused me the big headaches. When, with the standard SDK, the buttons worked fine with Chrome, Safari and Firefox, IE 8 was throwing errors until I switched to the asynchronous code *and* included the <html><body> … </body></html> tags.

      Please post your solution here, and make sure you surround your code with the <code> … </code> tags!

      Thanks!

  • http://www.hyperarts.com/blog/ Tim Ware

    Yes, they seem to work. I’m going to test on my IE 8 to doublecheck!

  • http://www.hyperarts.com/blog/ Tim Ware

    Hi Nina, The Share Button tutorial was not designed to be used by TabPress and likely won’t work since the app ID won’t match the TabPress App ID, and the URL used won’t match the domain that TabPress uses. Sorry!

    You would have to create your own custom Facebook app and our iFrame Page Tab tutorial shows how to do that.

  • http://www.hyperarts.com/blog/ Tim Ware

    Hi Caitlin, I can’t say given the information provided.

  • http://www.hyperarts.com/blog/ Tim Ware

    It’s exactly as I state: The URL for the app’s canvas page has to be the same domain as the URL the you’re using for the Share Button.

  • http://www.facebook.com/people/Jos-Van-de-Heuvelaar/100003318610105 Jos Van de Heuvelaar

    Hi!

    First of all, awesome tutorial! have been looking for a while to find this.

    I only have one problem, when I click the share button the dialog opens in a new tab in my browser instead of a pop-up screen. The example button on the hyperarts Facebook does however open in a pop-up. Does anyone know what might causing this? Thanks!

    • http://www.hyperarts.com/blog/ Tim Ware

      What’s the URL where you Share Button resides?

  • Anonymous

    Thanks for the tutorial, but instead of running FB.ui I want to run PHP code. How can I do that?

  • http://www.hyperarts.com/blog/ Tim Ware

    No.

  • http://pulse.yahoo.com/_YM747M4BZ7QZI2YAGGLYYUQTNQ Moiz

     how we can auto load it on page load.. as i have seen on different pages.. plz do answer i need this functionality urgently.. waiting for your response.

    • http://www.hyperarts.com/blog/ Tim Ware

      If you mean auto-click the Share button when the page loads? I haven’t seen this, and I don’t believe it’s possible. AND it’s a bad user experience. The user should decide whether or not to click the Share button!

  • http://www.hyperarts.com/blog/ Tim Ware

    Are you using Google’s Social Interactions tracking? You might read my post about Tracking Social Interactions with Google Analytics.
    And I assume you’re checking out Facebook’s Insights for Domains, yes? If not, read my post about this.

  • http://www.hyperarts.com/blog/ Tim Ware

    I’m afraid I can’t help you there.

    • cabouabdo

      Thanks for being responsive! You and Your site are awesome!

      • http://www.hyperarts.com/blog/ Tim Ware

        Always glad to help! :-)

  • asecondwill

    The share thing is deprecated. Iv’e just spent 24 hours trying to get the share & like buttons to work in a iframe page tab – with the share firing on page ready via jquery. fail.  epic fail.  

    • http://www.hyperarts.com/blog/ Tim Ware

      Hmm. I’ve gotten it to work, just today actually. What is the error you get? Are you using the latest JavaScript SDK code?

  • http://www.hyperarts.com/blog/ Tim Ware

    Does this share button example work for you?

    • asecondwill

      Not reliably.  It seems to come and go with  errors to do with the URL we want to share (the iframe page tab link) and displays a pop up rather than the proper modal for non-ssl connections

      • http://www.hyperarts.com/blog/ Tim Ware

        I asked if *our* share button example worked for you. It shares our URL. Did you get errors with our example? If you’re having trouble with URLs and your share button, remember — and as clearly called out in my tutorial — the URL you share MUST be on the same domain as the page the share button is on.

        • asecondwill

          Yep i’m using your example,as you say, it wouldn’t work on our iframe page if i didn’t update the link URL.  

          The main issue i’m facing is the modal vs pop up.  Is there a  way to make the modal/lightbox fire rather than a pop up window?

          Thanks

          will

        • http://www.hyperarts.com/blog/ Tim Ware

          I’m not aware of how you would do that, Will. Sorry!