Firefox not able to enumerate document.styleSheets[].cssRules[]

后端 未结 7 1793
-上瘾入骨i
-上瘾入骨i 2020-12-16 15:33

Here is the code:

  • http://jsfiddle.net/salman/2hyYg/
  • http://jsfiddle.net/salman/2hyYg/show/

You\'ll notice the alert(document.styl

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 16:17

    The stylesheet is there and works fine, you just cannot access the cssRules property of the stylesheet because it is set to null by the browser.

    The security error you get is due to the same origin policy - you are working on stylesheets from another domain, you will not have this problem if the stylesheets are hosted on the same domain your webpage is.

提交回复
热议问题