H
H
HHYRRE2018-03-11 10:14:01
JavaScript
HHYRRE, 2018-03-11 10:14:01

How to open a window and pass html to it?

var html = ""
var окно = window.open("about:blank", 'name')
окно.document.write(html)

— the code works, but through time.
The first time you run it, everything opens fine, but when you start it again, the tab becomes empty.
It is necessary that html is repeatedly opened in the same window.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Tallmange, 2018-03-11
@p00h

The documentation says:
As long as you do not create a different name for each new window, the call will go to the already open window, and access to its DOM is possible only if security requirements are met. For this reason the code fulfills only at opening.

A
Alexey, 2018-03-11
@Qwal

Make the modal window better and write any html there, because in fact it will be a div that is displayed and hidden using html and do not use Russian characters in variable names)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question