0

I've searched around for this and I don't see anything that quite explains what I'm trying to do.

GOAL:
Our company is building a mobile app alongside our desktop app. The CTO prefers two separate apps rather than one responsive app. The goal is to have the application navigate to either the mobile app or the desktop app based on the viewport. I can think of a two different options

  1. Use the same login screen and redirect on login completion
  2. Redirect once the baseURL is hit
    config/environment.js?

TOOLS:
Using the latest stable ember-cli to date 2.6.3

Lux
  • 17,835
  • 5
  • 43
  • 73
D.Breen
  • 51
  • 2
  • 9

1 Answers1

1

I don't think this is really ember specific.

Lets assume you have your two apps under two different domains. Like your main app under http://example.com and your mobile app under http://mobile.example.com.

Then you could just check your url, check the viewport, and if you think you should redirect to the other application add/remove the mobile. in your uri, directly with window.location.href = ....

A good place to do this is an initializer or the beforeModel hook of your application route.

Lux
  • 17,835
  • 5
  • 43
  • 73
  • So how do I grab the viewport in those hooks? – D.Breen Jul 17 '16 at 00:25
  • 1
    Just use `screen.width` or `window.innerWidth`. Check out [this](http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript) answer for example. – Lux Jul 17 '16 at 10:44