# Insert html into window

**URL:** <https://www.ruby-forum.com/t/insert-html-into-window/187194>\
**Category:** Rails\
**Created:** [April 19, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/insert-html-into-window/187194 "2010-04-19T16:34:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 19, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/insert-html-into-window/187194/1 "2010-04-19T16:34:18Z")

</div>

how do I insert html into a window? This doesn’t seem to work:

var testwindow = window.open ("", “mywindow”,  
“height=800,width=400,location=no,scrollbars=yes”);  
var el = testwindow.document.createElement(‘div’);  
el.innerHTML = content;

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 19, 2010, 5:06pm UTC](https://www.ruby-forum.com/t/insert-html-into-window/187194/2 "2010-04-19T17:06:31Z")

</div>

On Mon, Apr 19, 2010 at 7:32 AM, ES [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> how do I insert html into a window? This doesn’t seem to work:

You have four problems here:

1. this is a Rails mailing list – find a JavaScript list for this  
question
2. “doesn’t seem to work” –  
[How To Ask Questions The Smart Way](http://catb.org/~esr/faqs/smart-questions.html)

> var testwindow = window.open (“”, “mywindow”,  
> “height=800,width=400,location=no,scrollbars=yes”);  
> var el = testwindow.document.createElement(‘div’);

1. creating an element doesn’t insert it into the DOM

> el.innerHTML = content;

1. content is apparently undefined.

## HTH,

Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan
