-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
55 lines (42 loc) · 1.48 KB
/
index.md
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
52
53
54
55
---
title: 'Error: Permission denied to access property "x"'
slug: Web/JavaScript/Reference/Errors/Property_access_denied
page-type: javascript-error
---
{{jsSidebar("Errors")}}
The JavaScript exception "Permission denied to access property" occurs when there was
an attempt to access an object for which you have no permission.
## Message
```plain
DOMException: Blocked a frame with origin "x" from accessing a cross-origin frame. (Chromium-based)
DOMException: Permission denied to access property "x" on cross-origin object (Firefox)
SecurityError: Blocked a frame with origin "x" from accessing a cross-origin frame. Protocols, domains, and ports must match. (Safari)
```
## Error type
{{domxref("DOMException")}}.
## What went wrong?
There was attempt to access an object for which you have no permission. This is likely
an {{HTMLElement("iframe")}} element loaded from a different domain for which you
violated the [same-origin policy](/en-US/docs/Web/Security/Same-origin_policy).
## Examples
### No permission to access document
```html
<!doctype html>
<html lang="en-US">
<head>
<iframe
id="myframe"
src="http://www1.w3c-test.org/common/blank.html"></iframe>
<script>
onload = function () {
console.log(frames[0].document);
// Error: Permission denied to access property "document"
};
</script>
</head>
<body></body>
</html>
```
## See also
- {{HTMLElement("iframe")}}
- [Same-origin policy](/en-US/docs/Web/Security/Same-origin_policy)