[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
Display content based on UserAgent
Display content based on UserAgent

You can use the useragent parameter to check for certain sub-strings such as browser names and operating systems in the user agent string. This could be used to tailor content to specific devices such as mobile phones.
Notice in the following code that you can provide a comma separated list of tokens to be tested for. This acts like an OR, if any of the tokens match then the enclosed code will be rendered.

Code Block
{builder-show:useragent=Firefox,Opera}
You are using FireFox or Opera!
{builder-show}

By combining with the use-layout macro you can switch to a specific layout.
For example suppose you have created a layout for the iPhone.
Do the following on your home page and subsequent page will use your layout:

Code Block

{builder-show:useragent=iphone}
{use-layout:IPHONE_LAYOUT|latch=true}
{builder-show}

...

If you need to show or hide content based on the privileges within a space, use the show-if or hide-if macros that be found in the Visibility Pluginwith more complex conditions, there are extra aliases builder-show2 -> builder-show9 which may be used for nesting.

Frequently Asked Questions

...