Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question