开发者

Facebook-like share a link parsing?

开发者 https://www.devze.com 2023-04-01 09:55 出处:网络
How does facebook share a link parsing work? Given a url, i need to extract title, blurb and t开发者_开发知识库humbnail (if any).

How does facebook share a link parsing work? Given a url, i need to extract title, blurb and t开发者_开发知识库humbnail (if any).

Are there any libraries or widgets that already do this? (preferably client side javascript)


You cant do this on client only.

For the reason see: Why cant I load an external resource from jQuery load method? And the accepted answer there gives you the options.

You will have to do it like this:

  1. Create a server script that loads the page. Your javascript code sends a request with the given link to this script.
  2. This script may parse the requested page to get the wanted information (This answer may help you for PHP and this one for java)
  3. Your script may return JSON Data which you can process with javascript in the browser
0

精彩评论

暂无评论...
验证码 换一张
取 消