is

Check for a certain property in the user agent:

{{ agent().is('Windows') }}
{{ agent().is('Firefox') }}
{{ agent().is('iPhone') }}
{{ agent().is('OS X') }}

Magic is-method

Magic method that does the same as the previous is method:

{{ agent().isAndroidOS() }}
{{ agent().isNexus() }}
{{ agent().isSafari() }}

Mobile detection

Check for mobile device:

{{ agent().isMobile() }}
{{ agent().isTablet() }}

Match user agent

Search the user agent with a regular expression:

{{ agent().match('regexp') }}

Accepted languages

Get the browser's accepted languages. Example:

{{ agent().languages() }}
{# outputs: ['en-us', 'en'] #}

Device name

Get the device name, if mobile. (iPhone, Nexus, ...)

{{ agent().device() }}

Device Type

Get the device type. (desktop, tablet, mobile, ...)

{{ agent().deviceType() }}

Operating system

Get the operating system. (Ubuntu, Windows, OS X, ...)

{{ agent().platform() }}

Browser name

Get the browser name. (Chrome, IE, Safari, Firefox, ...)

{{ agent().browser() }}

Desktop detection

Check if the user is using a desktop device.

{{ agent().isDesktop() }}

Phone detection

Check if the user is using a phone device.

{{ agent().isPhone() }}

Robot detection

Check if the user is a robot.

{{ agent().isRobot() }}

Robot name

Get the robot name.

{{ agent().robot() }}

Browser/platform version

The version method is still in beta, so it might not return the correct result.

Get the browser or platform version you can use:

{% set browser = agent().browser() %}
{{ agent().version(browser) }}

{% set platform = agent().platform() %}
{{ agent().version(platform) }}

Was this helpful?

Copyright © 2024 Blutui.