Forum Discussion

peterlu's avatar
peterlu
Champion
12 years ago
Solved

view mode detection, desktop or mobile

Since there is no mobile version of "Front page welcome text" section in admin area, I am going to put freemarker to detect the view mode.

example:

if in mobile view mode

    hello mobile

else

    hello desktop

 

Is there any code example of how to do this?

  • You could try this:

     

    <#if clientDevice.desktop>
      <#-- do something -->
    </#if>
     
    <#if clientDevice.mobile>
      <#-- do something -->
    </#if>

2 Replies

  • VenkS's avatar
    VenkS
    Lithium Alumni (Retired)
    12 years ago

    You could try this:

     

    <#if clientDevice.desktop>
      <#-- do something -->
    </#if>
     
    <#if clientDevice.mobile>
      <#-- do something -->
    </#if>
  • MoniqueL's avatar
    MoniqueL
    Lithium Alumni (Retired)
    12 years ago

    You could also use your mobile specific text inside the component "mobile.widet.announcement"