Forum Discussion

peterlu's avatar
peterlu
Champion
12 years ago

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>
  • VenkS's avatar
    VenkS
    Lithium Alumni (Retired)

    You could try this:

     

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

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