Placing View on a different window

Was just looking at this SO question, and was wondering how it could be done with ember. Would I have to extend Ember.View and override the append hook?

Basically looking to make a “remote control” type of interface with two windows.

At the moment I try something like this (in didInsertElement):

didInsertElement: function () {
  var self = this,
    $this = this.$(),
    newWindow =, 'newwindow', 'directories=no, titlebar=no, to
    newDocument =,
    scripts = [],
    docHtml = '';
  scripts =  Ember.$(window.document).find('body > script').toArray().reduce(fu
    return value;
  }, []);
  docHtml = "<html>"
    + Ember.$(window.document).find('head').get(0).outerHTML
    + '<body><div id=\'new\'></div>'
    + scripts.toString()
    + '</body>'
    + "</html>";

  $detached = $this.detach();

This still seems wrong. Wish it was as easy as…

renderTemplate: function () {
    window: 'windowName'
1 Like

@wycats is there a standard way/best practice for doing this sort of thing?

Views depend on their associated DOM element being contained by the element associated with your Ember.Application instance. That would seem to make your goal of having views in multiple windows impossible.

If you really want two windows, then you’ll need two ember application instances running (one in each window).

I refuse to accept that answer :smile:, there has to be a way to do it without having 2 Ember Apps, which complicates things so much.

we have tackled this by having multiple ember apps in multiple frames/windows and using oasis/conductor to communicate. is a fairly complex example.

Currently ember doesn’t really have out-of-box support the kinda of cross frame semantics you require. If someone wants to explore it further I’m sure interesting solutions will come up.

In theory, you could do many crazy things, but I wouldn’t be responsible if i suggested any of them. :stuck_out_tongue:

1 Like

I forgot about those two. What’s the difference? They both seem to serve the same function, is it an either-or kind of relationship? is a fairly complex example.

I’ll have to have a look, thanks for the example.

Oasis.js mechanism for communicating between sandboxes. Conductor is mechanism for creating sandboxes.

1 Like

Ok, that makes sense, thanks @tarasm.