Page 77 - HTML5
P. 77

Chapter 18: IFrames




        Parameters




          Attribute         Details

                            Sets the element's name, to be used with an a tag to change the iframe's
          name
                            src.


          width             Sets the element's width in pixels.


          height            Sets the element's height in pixels.

          src               Specifies the page that will be displayed in the frame.


                            Specifies the content that will be displayed in the frame, assuming the
          srcdoc
                            browser supports it. The content must be valid HTML.

                            When set, the contents of the iframe is treated as being from a unique origin
                            and features including scripts, plugins, forms and popups will be disabled.
          sandbox
                            Restrictions can be selectively relaxed by adding a space separated list of
                            values. See the table in Remarks for possible values.


          allowfullscreen   Whether to allow the iframe’s contents to use requestFullscreen()



        Remarks



        An iframe is used to embed another document in the current HTML document.

        You CAN use iframes for displaying:

            •  other HTML pages on the same domain;
            •  other HTML pages on another domain (see below - Same-origin policy);
            •  PDF documents (though IE might have some problems, This SO question might help);


        You SHOULD use an iframe as a last resort, as it has problems with bookmarking and navigation,
        and there are always better options other than an iframe. This SO question should help you
        understand more about the ups and downs of iframes.




        Same-origin policy




        Some sites cannot be displayed using an iframe, because they enforce a policy called Same-origin
        policy. This means that the site that the iframe lies on must be on the same domain as the one to
        be displayed.


        https://riptutorial.com/                                                                               61
   72   73   74   75   76   77   78   79   80   81   82