Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharer.php despite appId #37

Open
thomasspiesser opened this issue Mar 24, 2015 · 14 comments
Open

sharer.php despite appId #37

thomasspiesser opened this issue Mar 24, 2015 · 14 comments

Comments

@thomasspiesser
Copy link

Thanks for this great package!
I have a small issue though. I configure my appId like so:

ShareIt.configure({
  sites: {
    'facebook': {
      'appId': 12345
    }
  },
  useFB: true,
  classes: "btn btn-xs",
  iconOnly: true,
});

Still, I don't get the dialog but the sharer.php. Any idea, what i might be doing wrong here?

@smowden
Copy link

smowden commented Mar 29, 2015

Had the same problem, see #38, you can use lovetostrike:shareit as a workaround or clone this repo into your packages until the package on atmosphere is updated. Both work as expected, but the currently published version doesn't have the option of using FB.ui unfortunately.

@thomasspiesser
Copy link
Author

ahh, thanks @smowden! I was browsing the github code and couldn't understand why it didn't work. will try the lovetostrike fork for the time being. thanks again!

@thomasspiesser
Copy link
Author

hey @smowden, did you get the one from lovetostrike to actually work? for me it 1) doesn't care what i put in the config, like useFB: true/false doesn't matter, always shows all 4 sharing buttons. 2) click on FB buttons throws a reference error to tell me FB is unknown.

@queso
Copy link
Member

queso commented Mar 30, 2015

I am working to get this tested and released guys.

@smowden
Copy link

smowden commented Mar 31, 2015

@thomasspiesser I worked around this by initing FB.UI myself (include the fb script and call FB.init)

@queso
Copy link
Member

queso commented Mar 31, 2015

I am less familiar with facebook UI scripts. Couldn't we just append the appId on the share url? Is there some advantage to FB.ui in js?

@queso
Copy link
Member

queso commented Mar 31, 2015

See:

https://www.facebook.com/dialog/share?
  app_id=145634995501895
  &display=popup
  &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
  &redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer

@smowden
Copy link

smowden commented Mar 31, 2015

no idea

@thomasspiesser
Copy link
Author

from their docs: If you are using the URL redirect dialog implementation, then this will be a full page display, shown within Facebook.com. This display type is called page.
with fb.ui you seem to have more options. however, i just tried to change the display=popup part of the url to page or iframe and that still works. so no idea.

@iSuslov
Copy link

iSuslov commented Apr 17, 2015

Any progress on this?

@rubencodes
Copy link

_bump_

@irode001
Copy link

irode001 commented Jul 2, 2015

Hi did you get fix the FB is not defined issue?
Thanks

@pmuens
Copy link

pmuens commented Jul 29, 2015

@irode001 you need to install the Facebook SDK (e.g. https://atmospherejs.com/biasport/facebook-sdk) to get rid of the FB.UI not defined bug. Additionally you need to add the version-Number for the Facebook API when initializing it:

if(Meteor.isClient) {
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '{your-app-id}',
      status     : true,
      version    : 'v2.0',
      xfbml      : true
    });
  };
}

@ShockiTV
Copy link

It is little more complex and readme confusion is taking it's toll too.
There is nowhere called ShareIt.init so that FB async load will never execute.

So if you want to use that FB auto init, you need to detect if FB was already loaded and if not initialize it.
This can be done few ways. For example Session variable, but I would strongly suggest against that.
One place to put it is in client initialization after DOM was rendered, so that means in Meteor.startup function.
But if you not use FB on many pages, this is not needed to be done always.
So I would suggest some global variable which will be used to determine if FB was already initialized. And if not, initialize it in your sharing template onRendered for example.

Or if autor add function to check this it would be best. Separate for twitter and facebook. And than during our template render it would run if ( ! ShareIt.FBinitialized ){ ShareIt.FBinit({}); )
That way it would use current configuration and if autoInit was selected it would initialize FB just once and will keep internal state in variable that it was initialized and than ShareIt.FBinitialized will always return true.

Or we can in our templates detect if FB object is defined, if not call ShareIt.init({autoInit: true});

But I prefer the one with internal state and functions checking it per service, cause even the initialization can fail due to network issues etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants