Detect Facebook share success?

前端 未结 2 1080
暖寄归人
暖寄归人 2021-01-06 08:30

I\'m looking to detect if a Facebook share on a page was successful, and upon success change the value of a box. I can handle the latter just fine, but am a little lost as

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-06 08:53

    Firstly you must include Facebook sdk.js library to use all its methods (ideally right after the opening of body tag)

    
    

    The problem with your http://jsfiddle.net/ysdp60cz/ is the scope of the facebookShare var. So, in this example, just include it in the window object:

    window.facebookShare = function( callback ) { [...]
    

    I don´t know how are you organizing your code, however, with this changes it must work.

    You can check it here: http://jsfiddle.net/benjasHu/3dhq9k21/

    Cheers.

提交回复
热议问题