views:

252

answers:

1

I've the following condition to check the user agent.

if request.env['HTTP_USER_AGENT'] =~ /feedburner/i 
 @posts = Post.recent(10)
 render :layout => false
else
 redirect_to 'http://feeds.feedburner.com/MyAppFeed'
end

Its working fine. Now I need to check for the facebook user agent! What would be the name of facebook user agent or is there any way to distinguish user agent between browser or other site internal bot??

+1  A: 

This crawl-bot can be identifyed by it’s user-agent: facebookexternalhit/1.0 ( http://www.facebook.com/externalhit_uatext.php)

Clement Herreman
Thanks for reply.But I fixed that with simple above defined regex.if request.env['HTTP_USER_AGENT'] =~ /facebook/i
Millisami