我正在尝试使用控制台将外部 CSS 加载到 Internet Explorer 中。当我编写注入(inject)代码时,它说存在语法错误。
$(document.head).append('<link rel="stylesheet" href="http://fahaduddin.com/css-new/mystyles.css">');
最佳答案
您可以使用此代码:
var element = document.createElement("link");
element.setAttribute("rel", "stylesheet");
element.setAttribute("type", "text/css");
element.setAttribute("href", "external.css");
document.getElementsByTagName("head")[0].appendChild(element);
关于javascript - 使用 JavaScript 在 Internet Explorer 中插入外部 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46439331/