Detecting RSS readers
Fri May 18, 2007 · 123 words

I find it strange that there's no (AFAIK) standard way to differentiate between a regular web browser and an RSS aggregator. Ideally, you'd think that the client requests a certain mimetype so your webapp could make some decisions. This isn't much of an issue in most cases, since you just provide an alternate link the the RSS feed, but I ran into a problem with authentication.

I wanted RSS users to be able to authenticate using standard HTTP methods, while still giving browser users a nice login window through which they could also reset the password or whatever. The best solution I could come up with thus far is this crude little test that identifies every major browser:

$is_browser = preg_match ("/(^Mozilla|^MSIE|^Opera).*/", $_SERVER['HTTP_USER_AGENT']);

back · essays · credits ·