In oTree <5, you could just have a single page without a next button that is displayed if the user is not using a mobile device. If you did the switch to valid device, that page wasn't displayed. The backend was like this:
class TestMobile(Page):
def is_displayed(self):
# Here, we'll obtain the type of user we've
user_agent = self.request.META['HTTP_USER_AGENT']
# Default value
self.participant.vars['is_mobile'] = False
# The default is changed if the player is mobile
for substring in ['Mobi', 'Android']:
if substring in user_agent:
self.participant.vars['is_mobile'] = True
return self.participant.vars['is_mobile']