Documentation >> Conditionals >> Web Server >> userAgentIsRobot
Conditional Macro: userAgentIsRobot
Operators:
Usage Notes
- Tests to see if the software that requested the page is a knownrobot or not.
- The User-Agent is the software running on the remote computer that requested the page, such as a web browser.
- A robot is an automated process running on a remote computer, that downloads web pages for indexing into a search engine or to a web archive, or for various other purposes.
- There are many known robots, but there are many more that we're not aware of yet. More are added all the time. If we don't recognize the "User-Agent" field that is sent with a request for a web page, then we assume that it is not a robot (since tests for robots are usually done to hide parts of pages, and you wouldn't want to hide something on the page simply because we didn't recognize someone's browser).
- In email and all other IO methods except the web server, this conditional macro always returns false.
Examples
This example would show line 1 only if the page were being requested by a robot (spider, indexer, archiver), and line 2 for every other situation.
<!--#if condition="userAgentIsRobot"-->
1. This is the line sent to indexers, spiders, crawlers, archivers, and all other known robots.
<!--#else-->
2. This is the line you'll see, if you're requesting the page with a browser or reading it in email.
<!--#endIf-->
See the above code in action, here:
1. This is the line sent to indexers, spiders, crawlers, archivers, and all other known robots.
View in DG
|