Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. JavaScript
  3. JavaScript 参考
  4. JavaScript 错误参考
  5. Error: Permission denied to access property "x"

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

Error: Permission denied to access property "x"

消息

Error: Permission denied to access property "x"

错误类型

错误.

什么地方出错了?

尝试访问无权访问的对象。这很可能出现在使用<iframe>元素时加载了一个不同域名下的页面,这在访问子页面时会违背同源策略

示例

html
<!doctype html><html>  <head>    <iframe           src="http://www1.w3c-test.org/common/blank.html"></iframe>    <script>      console.log(document.getElementById("myframe").contentWindow.document);      // Error: Permission denied to access property "document"    </script>  </head>  <body></body></html>

可以参考

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp