Answer the question
In order to leave comments, you need to log in
How to embed iframe only 1 time?
I am making a chrome extension, creating a popup by creating an iframe in the content script (I need an iframe and not a default popup).
I am creating an iframe.
I put it in via document.body.appendChild(iframe)
.
Everything works ok, BUT for the time being, until you open the application on a site where there are a bunch of other advertising iframes... For example, on the site https://www.rbc.ru/ , my iframes are created several times inside each advertising iframe given site.
QUESTION:
How can I create my iframe only once and put it only in the "Parent body" of the site?
Answer the question
In order to leave comments, you need to log in
when creating your iframe, you need to specify that window is the main iframe and not the secondary iframe. on a page with an iframe's you can determine if it is an iframe with the following code
if (window && window.top === window) {
// основная страница окна
} else {
// iframe
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question