Share Cache Timeout

醉酒当歌 提交于 2019-12-23 20:16:47

问题


How long is the timeout for facebook share cache. I edited all of my pages and changes must be reflected.

If timeout is unlimited, i have to debug all pages via curl etc.

Thanks.


回答1:


You can manually "clear" the facebook cache by using the Debugger.

Just go there, enter the url you changed and click "debug", that will cause the facebook bot to request the data from your servers even if it was already fetched and cached, and the new data will replace the old.


Edit

800k of pages is a lot, no doubt.

According to the Like Button doc:

Facebook scrapes your page every 24 hours to ensure the properties are up to date. The page is also scraped when an admin for the Open Graph page clicks the Like button and when the URL is entered into the Facebook URL Linter. Facebook observes cache headers on your URLs - it will look at "Expires" and "Cache-Control" in order of preference. However, even if you specify a longer time, Facebook will scrape your page every 24 hours.

(The URL Linter is the Debugger)

But from my experience it's not always the case, I haven't found any pattern to it, but I came across data that was months old and the cache was not clear until i manually used the debugger to extract the new data.

If you still want to manually refresh the data fb has, you can probably write a script that posts the url to the same form action in the Debugger page, I don't think they are using a csrf protection. In that way you can automate this action for all your pages, it might take a while, but nothing too serious.




回答2:


I was using window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url_to_share)) to make a share popup and no matter what I did, the cached share was not clearing until I did the following:

  • Put the URL you're trying to share into the Facebook URL Linter.
  • Scroll down to the "Share Preview"
  • Click "See this in the share dialog"
  • Copy the URL from that page
  • Put that URL in your window.open([put the url here]) popup and voila!


来源:https://stackoverflow.com/questions/10104908/share-cache-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!