Detect mobile with liquid

rdouggg
Shopify Partner
2 0 1

Hello,


I'm optimizing a theme and would like to render the content for the appropriate device.

Does anyone know if we have an object in liquid that returns whether the device is mobile or desktop?

 

For example:

 

{% if isMobile %}
{% comment %} Mobile content {% endcomment %}
{% else %}
{% comment %} Desktop content {% endcomment %}
{% endif %}

Thanks!

 

 

Replies 2 (2)

FrustratedCoder
Visitor
1 0 3

I am interested in this as well, seems like this would be a no-brainer native feature.

wiworks
Shopify Partner
1 0 1

This feature needs to be added. 👍