Difference between revisions of "Liquid Template Variables - request"
From Spiffy Stores Knowledge Base
Line 86: | Line 86: | ||
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 | ||
</pre> | </pre> | ||
+ | |||
+ | == <code>request.browser</code> == | ||
+ | |||
+ | Returns the name of the user's browser. | ||
+ | |||
+ | <pre> | ||
+ | Firefox | ||
+ | </pre> | ||
+ | |||
+ | == <code>request.browser_version</code> == | ||
+ | |||
+ | Returns the version of the user's browser. | ||
+ | |||
+ | <pre> | ||
+ | 25.0 | ||
+ | </pre> | ||
+ | |||
+ | == <code>request.browser_platform</code> == | ||
+ | |||
+ | Returns the platform of the user's browser. This will be the generic type of operating system that the user is running, such as Windows or Macintosh. | ||
+ | |||
+ | <pre> | ||
+ | Windows | ||
+ | </pre> | ||
+ | |||
+ | == <code>request.browser_os</code> == | ||
+ | |||
+ | Returns the operating system that the user's browser is running under. | ||
+ | |||
+ | <pre> | ||
+ | Windows 7 | ||
+ | </pre> | ||
+ | |||
+ | == <code>request.mobile?</code> == | ||
+ | |||
+ | Returns true if the user's browser is running on a mobile device. | ||
+ | |||
+ | == <code>request.bot?</code> == | ||
+ | |||
+ | Returns true if the request appears to be coming from a robot or web crawler. |
Revision as of 13:10, 19 June 2015
The Liquid template variable request has the following attributes:
Contents
- 1 request.parameter
- 2 request.host
- 3 request.url
- 4 request.remote_ip
- 5 request.country
- 6 request.country_code
- 7 request.city
- 8 request.timezone
- 9 request.currency
- 10 request.user_agent
- 11 request.browser
- 12 request.browser_version
- 13 request.browser_platform
- 14 request.browser_os
- 15 request.mobile?
- 16 request.bot?
request.parameter
You can access any request parameter by name.
For example, a URL can include a parameter:
http://storedemo.spiffystores.com/?theme=blue
This theme parameter can be accessed by
request.theme
request.host
Returns the host name portion of the URL request.
For example, if we go to http://storedemo.spiffystores.com, then the request.host returns:
storedemo.spiffystores.com
request.url
Returns the complete URL used for this request.
For example, if we go to http://storedemo.spiffystores.com/products/widget, then the request.url returns:
http://storedemo.spiffystores.com/products/widget
request.remote_ip
Returns the IP address of the user accessing the page.
request.country
Returns the Country name of the user accessing the page. This information is determined from the IP address, and may not be accurate in all cases. Typically, the results are 99.5% accurate.
The name returned is the ISO Printable name. For example:
Australia
request.country_code
Returns the two character ISO Country Code of the user accessing the page. This information is determined from the IP address, and may not be accurate in all cases. Typically, the results are 99.5% accurate.
The code returned is the ISO Code. For example:
AU
request.city
Returns the City name of the user accessing the page. This information is determined from the IP address, and may not be accurate in all cases. Typically, the results are 79% accurate. For example:
Sydney
request.timezone
Returns the Time Zone of the user accessing the page. This information is determined from the IP address, and may not be accurate in all cases.
The name returned is the standard timezone name. For example:
Australia/Sydney
request.currency
Returns the local currency of the user, based upon the Country from which the client has accessed the page. This information is determined from the IP address, and may not be accurate in all cases.
AUD
request.user_agent
Returns the user agent string of the user's browser. Each browser returns a unique user agent string, which provides information about the version and features that the browser provides.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
request.browser
Returns the name of the user's browser.
Firefox
request.browser_version
Returns the version of the user's browser.
25.0
request.browser_platform
Returns the platform of the user's browser. This will be the generic type of operating system that the user is running, such as Windows or Macintosh.
Windows
request.browser_os
Returns the operating system that the user's browser is running under.
Windows 7
request.mobile?
Returns true if the user's browser is running on a mobile device.
request.bot?
Returns true if the request appears to be coming from a robot or web crawler.