简体   繁体   中英

Add custom ttitle and message to Facebook dialog share

I'm trying to share a link on Facebook, but, with a custom title and message. Let me explain, I build my url like this :

var obj = {
 "object":"page.html",
 "image":"image.jpg",
 "data":{
   "title":"foo",
   "message":"bar"
  }
};

var furl = "https://www.facebook.com/dialog/share_open_graph?app_id=XXXXXXXXXX&display=popup&action_type=og.likes&action_properties=" + encodeURIComponent(JSON.stringify(obj)) + "&redirect_uri=" + encodeURI("page.html");

But, when I use the URL, the title and the description of the page are still the one provided by the page's meta tag and not the one I tried to defined. But, the custom image works well...

Any idea of what I could be missing ?

According to this article (posted on July 9, 2014), Facebook Share Dialog No Longer Accepts Custom Parameters ...

In the past, web developers were able to customize those elements by adding additional query parameters to the share dialog URL:

  • p[title] = Custom Title
  • p[summary] = Custom Description
  • p[images][0] = Custom Thumbnail Image

...

All of the shared content is now pulled from the page's Open Graph tags. For instance if you want to change the title or description, you must edit the page's og:title or og:description meta tags, respectively.

I hope it helped.

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