Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Detect mobile with liquid

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 2

This feature needs to be added. 👍