A
A
Apxu2017-09-14 11:24:29
JavaScript
Apxu, 2017-09-14 11:24:29

Why Facebook fumbles the picture from the 2nd - 3rd time?

Good afternoon,
we added a Facebook method method: 'share' to the button, which shares the page, taking information from og tags.
All tags are formed correctly, but when you click on the button, the picture appears only for the 2nd - 3rd time, i.e. I understand when it will be loaded on the Facebook server. Is it possible to somehow make a delay so that the window opens after the image is loaded, can it be opened and closed several times, or something else? Who faced such problem? How to decide?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2017-09-14
@zoonman

The delay is due to the fact that the Facebook robot needs to download a page on your site, parse it, find the image, download the image for itself, and then give it to the client. If your site is running slowly, then it takes a significant amount of time.
You can pre-cache your pages on Facebook, but in a reasonable amount
https://developers.facebook.com/docs/sharing/openg...
Like this:

curl -X POST \
     -F "id={object-url OR object-id}" \
     -F "scrape=true" \
     -F "access_token={your access token}" \
     "https://graph.facebook.com"

It is also very useful in cases of updating the picture. Actual thing in catalogs of goods and online stores.
You can put an Ajax call on the click that will make a request to the server, fix that the scraping has been done (so as not to knock on Facebook a second time), then call Share() in the callback.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question