The mere presence of this attribute will prevent the execution of potentially harmful or annoying features, protecting the document from script injections made by unwanted participants. The author of this document has conveniently added the comments as content of the srcdoc attribute of an iframe, to provide an extra layer of security, thanks to the sandbox attribute. The second example shows the comments section for a pulbication, where users discuss about the subject treated in the article. For your convenience, we've added a live version of the specification in this document. Cracking nuts like a master There's never been a nut cracker that didn't go by the book, so the first step you need to take is to read the "Nut cracker specification". This technique requires client-side scripting. This implementation could be easily adapted to fit another very frequent use of the element, which consist in pieces of content dynamically loaded into the iframe upon user interaction. In this example we're emulating a very common and useful practice, where authors include live versions of external documents for reference purposes. If no style is applied, the element would have a default and fixed width. Additionally, we're using CSS to make the element take all the horizontal space available, in order to improve presentation. You'll see how the browser applies a default height and conveniently provides the scrollbars to access the content that's outside the viewport. Here we're embedding a document, prepared specifically for this example, by specifying its URI in the src attribute. This example shows a basic and traditional use of the iframe element. The iframe element is an empty element, which means it can't have content between its opening and closing tags. This allows authors to safely embed third party content. The sandbox attribute, new in HTML5, fences the content of the embedded document disabling potentially harmful or annoying features like forms and scripts. The address from where the browser should retrieve the embedded document can be provided in the src attribute and lately, since the introduction of HTML5, this document can also be fully included as content of the srcdoc attribute. The iframe element represents a nested browsing context, which is basically a document nested in the current document.
0 Comments
Leave a Reply. |