Documentation >> Conditionals >> Web Server >> requestReferer
Conditional Macro: requestReferer
Operators:
- == (equal to)
- != (not equal to)
- beginsWith
- endsWith
- contains
Usage Notes
-
Tests the referer for the current request. The referer is a complete URL, generally for the page that contained a link which resulted in the current page being requested. So if page A has a link to page B, and you click on the link to page B, page A is the referer. The URL for page A is included in the request for page B, listed as the "referer".
-
This conditional tests the referer URL as a string, and compares it with the |conditional value| on the right of the |conditional operator|.
-
If there is no referer, then the referer is treated as an empty string: "".
-
In email and all other IO methods except the web server, the referer will be "" (an empty string).
Examples
This example will show line 1 if you came here by following a link to another page, or line 2 if you typed in the URL directly, followed the link from an email, or if your browser doesn't send the referer header for any reason. Also, line 1 uses another macro for demonstration purposes only.
<!--#if condition="requestReferer != ''"-->
1. You came here from the page: <!--#request.referer-->
<!--#else-->
2. No referer URL was provided.
<!--#endIf-->
See the above code in action, here:
2. No referer URL was provided.
View in DG
|