I wanted to know how does FB sharer work. I wanted to share different things with FB when the user is logge开发者_开发百科d into my website and not into my website. So i had 2 description tags i.e different for logged and not logged in users. But FB sharer is not recognizing it. It just displays only 1 description tag while sharing. I have used the FB lint also. Same problem i have there.
Does the user criteria does not work while sharing to FB?
The content that is displayed when a user shares / likes from your site is based on a scrape that is pulled every ~24hrs. If you're displaying a different page for logged in / logged out, then the Facebook servers can only see the logged out content and hence that's what's getting displayed from a share / in the linter.
If you check your server logs, you'll see a user-agent of facebookexternalhit/1.1. That's the Facebook Spider. Off the top of my head and without knowing your site's architecture, I can't really offer a good solution of how you'd provide FB with both versions, but at least you know what's causing the issue.
Well i think you should try facebook fb.ui method:
Example: http://fbrell.com/fb.ui/feed
Docs: https://developers.facebook.com/docs/reference/javascript/FB.ui/
With this method, you can easily customize your messages and also you can set different for logged in users and for guest visitors.
BTW to get that working, you should first add facebook js sdk
精彩评论