Skip to content

isBotAgent JavaScript

Analyze the user agent value to determine if it's a bot for a search engine. Returns true if it's a bot.

Parameters

  • userAgent::string

Returns

boolean

Examples

javascript
isBotAgent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'); // Returns true

Released under the MIT License