Where does ember-cli initialize the ember app?


#1

I’m fighting internet explorer here and we just want to wrap up the ember app to not even load if the browser is ember. I have ha a snippet that adds an ie class to the body element and I just want to jump into the code where the ember app gets initialized and wrap that to check if the ie class is present on the body tag. Where would I do that at?

I saw something in the ember-cli-build file that looks like it new EmberApp but I’m not sure if that’s it or not.


#2

The code to create your app is injected into index.html from here:

That doesn’t really answer your question, though. How to disable the Ember App from running if you’re running IE?

First, you should probably not even load the Ember app if the browser is IE, and that can be done from your server. Simply provide a different index.html if the user is using IE.

However, if you really want your Ember app to load but not run, you go into app.js and set the private property autoboot to false:

import Ember from 'ember';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver,
  autoboot: !window.isIE
});

loadInitializers(App, config.modulePrefix);

export default App;

Please note that autoboot is a private API, and may not be supported in future versions of Ember / Ember-CLI.


#3

It would also make more sense to me to not even load the app in IE, however the server option is tricky since we run the app out of an S3 bucket. So far I’m not seeing much in the way of detecting that to use somehow in the S3 redirection rules.

I have a small script on the page now that for the time being is adding a ie class to the body element for some style things. I tried to programmatically inject script tags into the page the same way but was having issues with it working properly, is there anything that could possibly be done there?