1

So I have a Dart app embedded in a page and it opens another window that has a preexisting page with just HTML/JS. I was trying to get info into the page and display it from inside Dart, roughly like so:

    var div = querySelector("#div_id");
    div.text = "my message";

I tried different variations of that with different kinds of elements, but no luck.

Eventually, I just wrote display code in JS on the child window HTML and I passed the information in using a query string.

So my question is: can Dart manipulate another page if that page doesn't have dart.js and other stuff embedded in it? Or am I simply doing something wrong?

Thanks for any insight.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
skyser5
  • 81
  • 5
  • 1
    I'm not familiar with Dart, but if you can get a reference (in the compiled Javascript) to the window handle that was opened, you can reference that window's `document` object like so: `[window reference] .document.querySelector(...)`. See http://stackoverflow.com/questions/10472927/add-content-to-a-new-open-window – Jared Farrish Apr 25 '14 at 22:39

1 Answers1

1

If you create the new Window using the window.open() method then you get back a WindowBase object. You can dig into the new window's DOM using this reference. For more information see https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-dom-html.Window#id_open

davecom
  • 1,499
  • 10
  • 30