如何将css文件添加到打开的窗口

时间:2016-08-12 07:15:32

标签: javascript jquery html css w3c

我正在尝试打开一个新的html窗口并将其链接到外部css文件..

var myWindow = window.open("", "MsgWindow");

var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", 'kamusi_ext-v1.css');

myWindow.document.head.appendChild(fileref);

但是我收到了这个错误:

  

script.js:70 Uncaught SecurityError:阻止具有原点“null”的帧访问具有原点“null”的帧。协议,域和端口必须匹配。

在Firefox上运行相同的脚本时,我没有收到此错误但css未被应用!

1 个答案:

答案 0 :(得分:0)

它似乎在这里工作:| enter image description here

enter image description here

我认为这与跨性别事物有关。谷歌搜索你提供的错误会给你一个提示。祝你好运!

相关问题