简体   繁体   中英

How can I display a popup window with a message after a user clicks the Facebook like button?

I'm a beginner and new to this sort of thing. I already have a like button on my website, but I want to display a popup window when a user clicks that like button. I've researched this extensively, but everything I've tried doesn't seem to work as many of the posts were outdated - such as this: Display content after clicking Facebook Like button

When I try to implement the code the like button disappears entirely.

Can someone show me a working implementation? Thanks!

The facebook api has something generic:

FB.Event.subscribe(event, callback)

I need that to tie into a popup window.

If using the Graph API, it would be like:

FB.Event.subscribe('edge.create', function(url, likeButtonElement){
  if(url === 'replace this String with like url String'){
    // do something with DOM maybe using likeButtonElement
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM