I want to open an html file with JavaScript and write some data into some of its elements. I tried the following:

```
var info_window = window.open('info_print.html')
info_window.document.getElementById('new_info').innerHTML = data;

```

But I get this error while I have the `#new_info` element:

```none
cannot set property 'innerHTML' of null

```

what should I do?
I checked the commented question but it was not as my question.