<p>Craft makes no distinction whether it's caching for mobile, tablet, desktop, etc., so it'll need to be taken care of on the template end.</p>

<p>You can easily do that with the "<a href="http://buildwithcraft.com/docs/templating/cache#using-key">using key</a>" parameter of the <a href="http://buildwithcraft.com/docs/templating/cache">{% cache %}</a> tag, though.</p>

<pre><code>{% if craft.request.isMobileBrowser %}
    {% set cacheKeyType = 'mobile' %}
{% else %}
    {% set cacheKeyType = 'desktop' %}
{% endif %}

{% cache using key "page-header-" ~ cacheKeyType %}
    ....
{% endcache %}
</code></pre>

CC BY-SA 3.0
2014-10-06T00:28:30.843Z
2014-10-06T00:28:30.843Z
Brad Bell
<p>Are different cache saved for Mobile / Tablet / localisations or do we have to take care of this?</p>

<p>I.e. if i use:</p>

<pre><code>{% if craft.request.isMobileBrowser() %} 
</code></pre>

<p>will the response be cached for desktop users as well?</p>

<cache>
Does the cache tag behave differently for Mobile vs Tablet vs Desktop?
# Does the cache tag behave differently for Mobile vs Tablet vs Desktop?

(Asked by: username_0 on 2014-10-05)

Are different cache saved for Mobile / Tablet / localisations or do we have to take care of this?
I.e. if i use:
{% if craft.request.isMobileBrowser() %} 

will the response be cached for desktop users as well?

**Tags:** cache

---

## 1 answers

### Answer by username_1 on 2014-10-06. Score: 7 | Accepted answer

Craft makes no distinction whether it's caching for mobile, tablet, desktop, etc., so it'll need to be taken care of on the template end.
You can easily do that with the "using key" parameter of the {% cache %} tag, though.
{% if craft.request.isMobileBrowser %}
    {% set cacheKeyType = 'mobile' %}
{% else %}
    {% set cacheKeyType = 'desktop' %}
{% endif %}

{% cache using key "page-header-" ~ cacheKeyType %}
    ....
{% endcache %}


---

