Memberscripts by Memberstack

#120 - Device/OS/Browser Conditional Visibility

Show/hide elements based on the device, operating system, or browser that a visitor is using. Also works with and/or statements!

Device Types

ms-code-device-show = "!mobile"

Will hide on mobile devices and small tablets, regardless of the operating system.

Something phones can't do
ms-code-device-show = "!tablet"

Will hide on tablets, regardless of the operating system.

Something tablets can't do
ms-code-device-show = "desktop"

Will show on laptops, desktops, and any larger device, regardless of the operating system.

Something only desktops can do
ms-code-device-show = "!touchdevice"

Will hide on any touch device.

Start clicking
ms-code-device-show = "landscape"

Will show on any device which is in landscape orientation.

Watch YouTube

Operating Systems

ms-code-device-show = "!ios"

Will hide on all devices running iOS - iPhones, iPads, and iPods.

Open website
ms-code-device-show = "!android"

Will hide on all devices running an android operating system.

Open website
ms-code-device-show = "!macos"

Will hide on all devices running MacOS.

Use web app
ms-code-device-show = "!windows"

Will hide on all devices running Windows.

Use web app
ms-code-device-show = "linux"

Will show on all devices running Linux.

Download for Linux

Browsers

While we're only showing the positive attributes (without a "!"), you can add the exclamation mark and it will still work as you intend it to!

Creating Conditions

When specifying your rules in the attribute values, you can use "&" to create an "and" rule (ex. If the device is MacOS AND is using Opera as a browser), and you can use "|" to create an "or" rule (ex. If the device is Linux OR Windows).