Forum Discussion

jc758's avatar
jc758
Advisor
11 years ago

Disable mobile view with freemarker

Hi

 

I would like to disable the mobile view for a particular blog (and go responsive).

 

I know I we can set a skin in the page initialization like that:

 

<#if page.name == "custom-page-id" >
  ${skin.set("custom_skin")}
</#if>

 Is there a way to force the desktop view to be applied?

 

regards

 

JC

  • Ok

    for the moment i've got this workaround:

     

    <#if coreNode.id == "my-blog" && clientDevice.mobile>
       <#assign mob_check = http.session.attributes.name.get("mobilecheck", "no") />
      <#if mob_check == "no">
        ${http.session.setAttribute("mobilecheck", "done")}
        <#assign redir_url = http.request.url?replace("?device-view=mobile","") />
        <#assign redir_url = redir_url + "?device-view=desktop" />
        ${http.response.setRedirectUrl(redir_url)}
      </#if>
    </#if>

     

     

    but I guess I could do the same thing in a proper way ...

    Can we access the session var for the clientDevice?

     

    More generally , any suggestion ?

     

    regards

     

    JC