Reference - device macros

CurrentDevice

The CurrentDevice object holds information about the device detected for the current visitor. The system identifies devices based on their user agent and retrieves the data about the capabilities of devices from the integrated 3rd party component 51degrees.mobi or the ~\App_Data\CMSModules\DeviceProfile\devices.xml file.

You can take advantage of the CurrentDevice object when defining conditions for device profiles and in general macro expressions.

The following list presents the properties of the CurrentDevice object. Most of the properties are only available in the 51degrees.mobi Premium data:

  • BitsPerPixel - color depth that the device's display supports.
  • BrowserName
  • BrowserVendor
  • BrowserVersion
  • CcppAccept - list of MIME types that the device supports.
  • CookiesCapable - indicates if the device can accept cookies.
  • DeviceName
  • HardwareModel
  • HardwareName
  • HardwareVendor
  • HasCamera
  • HasKeypad
  • HasQwertyPad
  • HasTouchscreen
  • HasTrackpad
  • HasVirtualQwerty
  • HtmlVersion
  • IsCrawler
  • IsMobile
  • IsTablet
  • JavaScript - indicates if the device supports JavaScript.
  • LayoutEngine - name of the rendering engine that the device uses.
  • MaxScreenSize - size of the longer side of the device's screen.
  • PlatformName
  • PlatformVendor
  • PlatformVersion
  • ScreenPixelsHeight
  • ScreenPixelsWidth
  • StreamingAccept
  • SupportedBearers
  • UserAgent

CurrentDeviceProfile

To get information about the device profile assigned to the current visitor, use the CurrentDeviceProfile object in macros:

  • You can access the device profile's system data through its properties, for example: {% CurrentDeviceProfile.ProfilePreviewWidth %}
  • To directly get the device profile's name, use the following expression: {% CurrentDeviceProfileName %}