Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook sharer and prerender.io (in an angularjs app)

I've just setup prerender.io middlewave into my tomcat server (running some java webservices and an angularjs app).

The service (prerender) works as it should and I can see the pages adding to the list (also when I send a request simulation the user agent).

My problem is with the Facebook share button (from addthis).

Basically if I visit a not yet cached page and click the "Share on Facebook" button, it will show me the angularjs template and not the "rendered" one.

The strange thing is that I then can see the page on Prerender.io admin.

It's like it's too slow and it times out. Still I don't know how it get the non-cached version of the page.

After the first wrong call Facebook caches the page so if I don't manually refresh it from the Facebook Object Debugger (https://developers.facebook.com/tools/debug/og/object) the wrong page will stay cached on FB servers until the FB cache is refreshed.

Anyway has any suggestion on how to fix this?

I could pre-cache every page but I will have to deal with new pages and I don't think it's a nice solution.

thanks, Dem

like image 865
demetrio812 Avatar asked Jun 13 '14 02:06

demetrio812


1 Answers

I have the same issue and it still bothers me a lot.

What you can do is after you create your page (typically your user save something), then you can create a server call to prerender to recache your page. After some time (for example 1 min) you can invoke an another call to facebook to refresh its cache...

The only issue with this, it works only after couple of minutes... :(

like image 95
Andrej Avatar answered Oct 06 '22 00:10

Andrej