# iframe

### [Attributes](https://www.w3schools.com/tags/tag_iframe.asp) - 
1. [Global Attributes](https://www.w3schools.com/tags/ref_standardattributes.asp) include  
2.  Allow = Specifies a feature policy for the 
[Feature policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy#concepts_and_usage)= allows web developers to selectively enable, Disable, and modify the behavior of certain features andAPIs in the browser 
3. [Referrerpolicy](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-referrerpolicy) = Specifies which referrer information to send when fetching the iframe

> **Examples of feature policy  -** 
1. Change the default behavior of autoplay on mobile and third party videos
2. Restrict a site from using sensitive devices like the camera, microphone, or speakers. 
3. Block the use of outdated APIs like synchronous XHRand document.write()

Iframe Allow Attribute  = Use the allow attribute to specify a policy list for embedded content. 
this blocks the **iframe **from using the camera and microphone:
```
<iframe allow="camera 'none'; microphone 'none'">…</iframe>
```
### Window Objects     [->](https://www.w3schools.com/jsref/dom_obj_frame.asp)
``` it can be accessed by index numbers```
1.   frameElement property - returns the frame where the window runs.  
   A frame can be any embedding element:
```<frame>, <iframe>, <embed>, <object>, etc.``` 
2. window.length - property returns the number of (framed) windows in the window.
3.    frames property  - returns an array with all window objects in the window ```Its change the location of the first iframe element (index 0)```

```
function myFunction() {
  window.frames[0].location = "https://www.w3schools.com/jsref/";
}
``` 
### HTML DOM IFrame Object
1.  Create an IFrame Object -  by using the document.createElement() method

```
function myFunction() {
  var x = document.createElement("IFRAME");
  x.setAttribute("src", "https://www.w3schools.com");
  document.body.appendChild(x); // appends a node (element) as the 
                                                      last child of an element
}
```
2.  The sandbox attribute - enable security restrictions for iframes with untrusted content (such as scripts and forms).

##  IFrame object also supports the standard ```HTML DOM Elements``` and ``` HTML DOM Events```
> **Window.parent** -  property is a reference to the parent of the current window or subframe.
> **window.top ** - returns a reference to the top-level window.


