Search code examples
apachetemplatesfreemarkerresponsivescreen-size

Is there a way to detect screen size with Apache Freemarker (ftl) templates?


Is there a way to detect screen width with just Freemarker templates? I'm looking for something along the lines of the following:

<#if screenwidth > 980px >
  <#include "big_banner.ftl">
<#else>
  <#include "small_banner.ftl">
</#if>

Thanks!


Solution

  • It's out of the scope of FreeMarker. You could add a screenWidth to the data-model, but FreeMarker doesn't tell how to calculate the value of that.