User redirect to mobile/desktop site

Disclaimer: Not suggesting this is the best/correct/greatest approach but it works* for me for now.

Like others on here a bit frustrated with having two different URLs for your site (mobile & desktop) a hopefully temporary solution till Glide offers an official solution I have created a redirect script that depending on user-agent or screen size or feature detection will redirect user to either mobile or desktop (full) view.

For example if user clicks or navigates to with a screen size less than 700px then redirect user to (mobile version) else redirect user to (desktop).

Pretty simple to setup. My script with base domain is hosted on Firebase which has a very generous free tier.

Hope this helps.


Hello !
your script is very interesting. Can you share it?


@Adam_Acosta: thank you for sharing!

Presumably, we could extend this even further to force different view depending not just on the screen size but also on the orientation, particularly in tablet view? e.g. if user is viewing the app in portrait mode then show mobile version; if user is viewing in landscape mode then show full screen desktop version?

Lots of resources on this topic but for a very simple option

a more robust solution could make use of this library


Didn’t test this but don’t see why it wouldn’t work. However once tablet user changes orientation you wouldn’t be able to update the view.

I think another good (again, hopefully) temporary supplemental measure is to include links to each view in a Glide app screen itself. You always want to give the user the ability to view it how they want especially since no user-agent/feature detection/resolution/etc redirect script is going to be 100% perfect.


Thank you @Adam_Acosta - we’ll look into this.