aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/errors/property_access_denied/index.html
blob: 0d3057702a9a5ff49602522a087c4f1795967857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: 'Error: Permission denied to access property "x"'
slug: Web/JavaScript/Reference/Errors/Property_access_denied
tags:
- Error
- Errors
- JavaScript
- Security
translation_of: Web/JavaScript/Reference/Errors/Property_access_denied
---
<div>{{jsSidebar("Errors")}}</div>

<p>JavaScript の例外 "Permission denied to access property" は、権限がない状態でオブジェクトへのアクセスの試行があった場合に発生します。</p>

<h2 id="Message">エラーメッセージ</h2>

<pre class="brush: js">Error: Permission denied to access property "x"
</pre>

<h2 id="Error_type">エラーの種類</h2>

<p>{{jsxref("Error")}}</p>

<h2 id="What_went_wrong">エラーの原因</h2>

<p>権限がない状態でオブジェクトへのアクセスの試行がありました。これは異なるドメインから読み込んだ {{HTMLElement("iframe")}} 要素が<a href="/ja/docs/Web/Security/Same-origin_policy">同一オリジンポリシー</a>に違反する場合などです。</p>

<h2 id="Examples"></h2>

<h3 id="No_permission_to_access_document">文書にアクセスする権限がない</h3>

<pre class="brush: html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;iframe id="myframe" src="http://www1.w3c-test.org/common/blank.html"&gt;&lt;/iframe&gt;
    &lt;script&gt;
      onload = function() {
        console.log(frames[0].document);
        // Error: Permission denied to access property "document"
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;&lt;/body&gt;
&lt;/html&gt;</pre>

<h2 id="See_also">関連情報</h2>

<ul>
  <li>{{HTMLElement("iframe")}}</li>
  <li><a href="/ja/docs/Web/Security/Same-origin_policy">同一オリジンポリシー</a></li>
</ul>