# User redirect to mobile/desktop site

**URL:** <https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009>\
**Category:** Ask for Help\
**Created:** [May 12, 2020, 10:36pm UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009 "2020-05-12T22:36:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Acosta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/adam_acosta/32/73_2.png) [@Adam\_Acosta](https://community.glideapps.com/u/Adam_Acosta)\
**Post date:** [May 12, 2020, 10:36pm UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/1 "2020-05-12T22:36:30Z")

</div>

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 [myglideapp.com](http://myglideapp.com) with a screen size less than 700px then redirect user to [app.myglideapp.com](http://app.myglideapp.com) (mobile version) else redirect user to [app.myglideapp.com/full](http://app.myglideapp.com/full) (desktop).

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

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Jeremie\_maga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeremie_maga/32/103_2.png) [@Jeremie\_maga](https://community.glideapps.com/u/Jeremie_maga)\
**Post date:** [May 13, 2020, 7:36am UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/2 "2020-05-13T07:36:20Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![garrison](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/garrison/32/22059_2.png) [@garrison](https://community.glideapps.com/u/garrison)\
**Post date:** [May 13, 2020, 8:19am UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/3 "2020-05-13T08:19:32Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![Adam\_Acosta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/adam_acosta/32/73_2.png) [@Adam\_Acosta](https://community.glideapps.com/u/Adam_Acosta)\
**Post date:** [May 13, 2020, 1:58pm UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/4 "2020-05-13T13:58:21Z")

</div>

Lots of resources on this topic but for a very simple option [https://css-tricks.com/snippets/javascript/redirect-mobile-devices/](https://css-tricks.com/snippets/javascript/redirect-mobile-devices/)

a more robust solution could make use of this library [https://github.com/faisalman/ua-parser-js](https://github.com/faisalman/ua-parser-js)

---

<div class="post-metadata">

**Author:** ![Adam\_Acosta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/adam_acosta/32/73_2.png) [@Adam\_Acosta](https://community.glideapps.com/u/Adam_Acosta)\
**Post date:** [May 13, 2020, 2:04pm UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/5 "2020-05-13T14:04:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![garrison](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/garrison/32/22059_2.png) [@garrison](https://community.glideapps.com/u/garrison)\
**Post date:** [May 13, 2020, 2:13pm UTC](https://community.glideapps.com/t/user-redirect-to-mobile-desktop-site/9009/6 "2020-05-13T14:13:01Z")

</div>

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