I
I
Ivan2020-05-01 09:28:37
css
Ivan, 2020-05-01 09:28:37

How to insert CSS style into a frame that is being rendered by another script?

Hello comrades! Need a crutch to help solve the problem.
The web page has a script that renders a frame from another site. You need to embed in this frame and include your CSS file there.

How can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lord_Dantes, 2020-05-01
@Lord_Dantes

Try this, just specify to whom you assign the file connection

document.addEventListener("DOMContentLoaded", () => {
let cssLink = document.createElement("link");
cssLink.href = "путь к файлу css";
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
setTimeout(() => {
document.querySelector('iframe#form').contentDocument.head.appendChild(cssLink);
}, 2000);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question