Check client platform: Desktop or Mobile

@stein - here’s one way you might go about it:
take a look at stackoverflow for the question in javascript:

and then adapt a solution using anvil.js.window

the most popular answer in stackoverflow can be adapted as follows:

from anvil.js.window import navigator
import re
mobile_devices = "Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini"
is_mobile = re.search(mobile_devices, navigator.userAgent) is not None

9 Likes