This is done by defining an onload callback on the iframe: iframe1.onload = function() ' Detecting when the iframe’s content has been loadedīefore you can access the contents of the iframe, you will have to wait for the iframe contents to be loaded (just like you should wait for the contents of your page to be fully loaded before accessing and manipulating them). In this case the source for the iframe contents is an HTML page on the same host/domain but you could also define a complete URL pointing to another location. Here’s a short example: var iframe1 = document.getElementById('iframe1') align: Was used to set the alignment of an inline frame relative to surrounding elements. scrolling: Was used to toggle scrolling on iframes. And styling it can be done by using the style property. Places a set of security and usability restrictions on the iframe. If this directive is absent, the user agent will look for the child-src directive (which falls back to the default-src directive).
Setting the URL which contents need to be loaded in the iframe, just means setting the src property of the iframe object. The HTTP Content-Security-Policy (CSP) frame-src directive specifies valid sources for nested browsing contexts loading using elements such as and