Annotation of html5/spec/the-iframe-element.html, revision 1.340

1.233     mike        1: <!DOCTYPE html>
1.304     sruby       2: <html lang="en-US-x-Hixie"><head><title>4.8.2 The iframe element &#8212; HTML5</title><style type="text/css">
1.1       mike        3:    pre { margin-left: 2em; white-space: pre-wrap; }
                      4:    h2 { margin: 3em 0 1em 0; }
                      5:    h3 { margin: 2.5em 0 1em 0; }
                      6:    h4 { margin: 2.5em 0 0.75em 0; }
                      7:    h5, h6 { margin: 2.5em 0 1em; }
                      8:    h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
                      9:    h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
                     10:    p { margin: 1em 0; }
                     11:    hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
                     12:    dl, dd { margin-top: 0; margin-bottom: 0; }
                     13:    dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
                     14:    dt + dt { margin-top: 0; }
                     15:    dd dt { margin-top: 0.25em; margin-bottom: 0; }
                     16:    dd p { margin-top: 0; }
                     17:    dd dl + p { margin-top: 1em; }
                     18:    dd table + p { margin-top: 1em; }
                     19:    p + * > li, dd li { margin: 1em 0; }
                     20:    dt, dfn { font-weight: bold; font-style: normal; }
1.83      mike       21:    i, em { font-style: italic; }
1.1       mike       22:    dt dfn { font-style: italic; }
                     23:    pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
                     24:    pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
                     25:    pre em { font-weight: bolder; font-style: normal; }
                     26:    @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
                     27:    var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
                     28:    table { border-collapse: collapse; border-style: hidden hidden none hidden; }
                     29:    table thead, table tbody { border-bottom: solid; }
                     30:    table tbody th:first-child { border-left: solid; }
                     31:    table tbody th { text-align: left; }
                     32:    table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
                     33:    blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
                     34: 
                     35:    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
                     36:    .matrix, .matrix td { border: none; text-align: right; }
                     37:    .matrix { margin-left: 2em; }
                     38:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                     39:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                     40:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                     41: 
                     42:    .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
1.96      mike       43:    img.extra, p.overview { float: right; }
1.94      mike       44:    pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
1.1       mike       45:    pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
1.94      mike       46:    pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
1.1       mike       47:    pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
                     48:    pre.css:first-line { color: #AAAA50; }
                     49:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
                     50:    hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
                     51:    dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
                     52:    dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
                     53:    dl.domintro dd p { margin: 0.5em 0; }
1.124     mike       54:    dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
1.1       mike       55:    dl.switch { padding-left: 2em; }
                     56:    dl.switch > dt { text-indent: -1.5em; }
                     57:    dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
                     58:    dl.triple { padding: 0 0 0 1em; }
                     59:    dl.triple dt, dl.triple dd { margin: 0; display: inline }
                     60:    dl.triple dt:after { content: ':'; }
                     61:    dl.triple dd:after { content: '\A'; white-space: pre; }
                     62:    .diff-old { text-decoration: line-through; color: silver; background: transparent; }
                     63:    .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
                     64:    a .diff-new { border-bottom: 1px blue solid; }
                     65: 
1.327     sruby      66:    figure.diagrams { border: double black; background: white; padding: 1em; }
                     67:    figure.diagrams img { display: block; margin: 1em auto; } 
                     68: 
1.1       mike       69:    h2 { page-break-before: always; }
                     70:    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
                     71:    h1 + h2, hr + h2.no-toc { page-break-before: auto; }
                     72: 
1.26      mike       73:    p  > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
                     74:    li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
1.1       mike       75: 
                     76:    div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
                     77:    div.head p { margin: 0; }
                     78:    div.head h1 { margin: 0; }
                     79:    div.head .logo { float: right; margin: 0 1em; }
                     80:    div.head .logo img { border: none } /* remove border from top image */
                     81:    div.head dl { margin: 1em 0; }
                     82:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
                     83: 
                     84:    body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
                     85:    body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
                     86:    body > .toc > li > * { margin-bottom: 0.5em; }
                     87:    body > .toc > li > * > li > * { margin-bottom: 0.25em; }
                     88:    .toc, .toc li { list-style: none; }
                     89: 
                     90:    .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
                     91:    .brief li { margin: 0; padding: 0; }
                     92:    .brief li p { margin: 0; padding: 0; }
                     93: 
                     94:    .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
                     95:    .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
                     96:    .category-list li { display: inline; }
                     97:    .category-list li:not(:last-child)::after { content: ', '; }
                     98:    .category-list li > span, .category-list li > a { text-transform: lowercase; }
                     99:    .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
                    100: 
                    101:    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
                    102:    .XXX > :first-child { margin-top: 0; }
                    103:    p .XXX { line-height: 3em; }
                    104:    .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
                    105:    .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
                    106:    .annotation :link, .annotation :visited { color: inherit; }
                    107:    .annotation :link:hover, .annotation :visited:hover { background: transparent; }
                    108:    .annotation span { border: none ! important; }
                    109:    .note { color: green; background: transparent; font-family: sans-serif; }
                    110:    .warning { color: red; background: transparent; }
                    111:    .note, .warning { font-weight: bolder; font-style: italic; }
1.83      mike      112:    .note em, .warning em, .note i, .warning i { font-style: normal; }
1.1       mike      113:    p.note, div.note { padding: 0.5em 2em; }
                    114:    span.note { padding: 0 2em; }
                    115:    .note p:first-child, .warning p:first-child { margin-top: 0; }
                    116:    .note p:last-child, .warning p:last-child { margin-bottom: 0; }
                    117:    .warning:before { font-style: normal; }
                    118:    p.note:before { content: 'Note: '; }
                    119:    p.warning:before { content: '\26A0 Warning! '; }
                    120: 
                    121:    .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
                    122:    .bookkeeping { font-size: 0.8em; margin: 2em 0; }
                    123:    .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.12      mike      124:    .bookkeeping dt { margin: 0.5em 2em 0; }
                    125:    .bookkeeping dd { margin: 0 3em 0.5em; }
1.1       mike      126: 
                    127:    h4 { position: relative; z-index: 3; }
                    128:    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
                    129:    .element {
                    130:      background: #EEEEFF;
                    131:      color: black;
                    132:      margin: 0 0 1em 0.15em;
                    133:      padding: 0 1em 0.25em 0.75em;
                    134:      border-left: solid #9999FF 0.25em;
                    135:      position: relative;
                    136:      z-index: 1;
                    137:    }
                    138:    .element:before {
                    139:      position: absolute;
                    140:      z-index: 2;
                    141:      top: 0;
                    142:      left: -1.15em;
                    143:      height: 2em;
                    144:      width: 0.9em;
                    145:      background: #EEEEFF;
                    146:      content: ' ';
                    147:      border-style: none none solid solid;
                    148:      border-color: #9999FF;
                    149:      border-width: 0.25em;
                    150:    }
                    151: 
                    152:    .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
                    153:    td > .example:only-child { margin: 0 0 0 0.1em; }
                    154: 
                    155:    ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
                    156:    ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
                    157:    ul.domTree li li { list-style: none; }
                    158:    ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    159:    ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    160:    ul.domTree span { font-style: italic; font-family: serif; }
                    161:    ul.domTree .t1 code { color: purple; font-weight: bold; }
                    162:    ul.domTree .t2 { font-style: normal; font-family: monospace; }
                    163:    ul.domTree .t2 .name { color: black; font-weight: bold; }
                    164:    ul.domTree .t2 .value { color: blue; font-weight: normal; }
                    165:    ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
                    166:    ul.domTree .t7 code, .domTree .t8 code { color: green; }
                    167:    ul.domTree .t10 code { color: teal; }
                    168: 
                    169:    body.dfnEnabled dfn { cursor: pointer; }
                    170:    .dfnPanel {
                    171:      display: inline;
                    172:      position: absolute;
                    173:      z-index: 10;
                    174:      height: auto;
                    175:      width: auto;
                    176:      padding: 0.5em 0.75em;
                    177:      font: small sans-serif, Droid Sans Fallback;
                    178:      background: #DDDDDD;
                    179:      color: black;
                    180:      border: outset 0.2em;
                    181:    }
                    182:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    183:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    184:    .dfnPanel p { font-weight: bolder; }
                    185:    .dfnPanel * + p { margin-top: 0.25em; }
                    186:    .dfnPanel li { list-style-position: inside; }
                    187: 
                    188:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    189:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    190:    #configUI p label { display: block; }
                    191:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    192:    #configUI input[type=button] { display: block; margin: auto; }
1.11      mike      193: 
1.30      mike      194:    fieldset { margin: 1em; padding: 0.5em 1em; }
                    195:    fieldset > legend + * { margin-top: 0; }
1.21      mike      196:    fieldset > :last-child { margin-bottom: 0; }
1.30      mike      197:    fieldset p { margin: 0.5em 0; }
                    198: 
1.304     sruby     199:   </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><style type="text/css">
1.1       mike      200: 
                    201:    .applies thead th > * { display: block; }
                    202:    .applies thead code { display: block; }
                    203:    .applies tbody th { whitespace: nowrap; }
                    204:    .applies td { text-align: center; }
                    205:    .applies .yes { background: yellow; }
                    206: 
1.14      mike      207:    .matrix, .matrix td { border: hidden; text-align: right; }
1.1       mike      208:    .matrix { margin-left: 2em; }
                    209: 
                    210:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    211:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    212:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    213: 
1.17      mike      214:    td.eg { border-width: thin; text-align: center; }
                    215: 
1.1       mike      216:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    217:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    218:    #table-example-1 caption { padding-bottom: 0.5em; }
                    219:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    220:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    221:    #table-example-1 th { font-weight: normal; }
                    222:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    223:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    224:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    225:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    226:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    227:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    228:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    229:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    230:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    231:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    232: 
                    233:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    234:    .apple-table-examples * { font-family: "Times", serif; }
                    235:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    236:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    237:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    238:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    239:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    240:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    241:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    242:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    243:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    244:    .apple-table-examples sup { line-height: 0; }
                    245: 
                    246:    .details-example img { vertical-align: top; }
                    247: 
1.40      mike      248:    #base64-table {
                    249:      white-space: nowrap;
                    250:      font-size: 0.6em;
                    251:      column-width: 6em;
                    252:      column-count: 5;
                    253:      column-gap: 1em;
                    254:      -moz-column-width: 6em;
                    255:      -moz-column-count: 5;
                    256:      -moz-column-gap: 1em;
                    257:      -webkit-column-width: 6em;
                    258:      -webkit-column-count: 5;
                    259:      -webkit-column-gap: 1em;
                    260:    }
                    261:    #base64-table thead { display: none; }
                    262:    #base64-table * { border: none; }
                    263:    #base64-table tbody td:first-child:after { content: ':'; }
                    264:    #base64-table tbody td:last-child { text-align: right; }
                    265: 
1.1       mike      266:    #named-character-references-table {
1.19      mike      267:      white-space: nowrap;
1.1       mike      268:      font-size: 0.6em;
1.19      mike      269:      column-width: 30em;
1.1       mike      270:      column-gap: 1em;
1.19      mike      271:      -moz-column-width: 30em;
1.1       mike      272:      -moz-column-gap: 1em;
1.19      mike      273:      -webkit-column-width: 30em;
1.1       mike      274:      -webkit-column-gap: 1em;
                    275:    }
1.19      mike      276:    #named-character-references-table > table > tbody > tr > td:first-child + td,
1.1       mike      277:    #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
                    278:    #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
1.19      mike      279:    #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
1.1       mike      280: 
1.2       mike      281:    .glyph.control { color: red; }
                    282: 
1.4       mike      283:    @font-face {
                    284:      font-family: 'Essays1743';
1.325     sruby     285:      src: url('../fonts/Essays1743.ttf');
1.4       mike      286:    }
                    287:    @font-face {
                    288:      font-family: 'Essays1743';
                    289:      font-weight: bold;
1.325     sruby     290:      src: url('../fonts/Essays1743-Bold.ttf');
1.4       mike      291:    }
                    292:    @font-face {
                    293:      font-family: 'Essays1743';
                    294:      font-style: italic;
1.325     sruby     295:      src: url('../fonts/Essays1743-Italic.ttf');
1.4       mike      296:    }
                    297:    @font-face {
                    298:      font-family: 'Essays1743';
                    299:      font-style: italic;
                    300:      font-weight: bold;
1.325     sruby     301:      src: url('../fonts/Essays1743-BoldItalic.ttf');
1.4       mike      302:    }
                    303: 
1.304     sruby     304:   </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script>
1.45      mike      305:    function getCookie(name) {
                    306:      var params = location.search.substr(1).split("&");
                    307:      for (var index = 0; index < params.length; index++) {
                    308:        if (params[index] == name)
                    309:          return "1";
                    310:        var data = params[index].split("=");
                    311:        if (data[0] == name)
                    312:          return unescape(data[1]);
                    313:      }
                    314:      var cookies = document.cookie.split("; ");
                    315:      for (var index = 0; index < cookies.length; index++) {
                    316:        var data = cookies[index].split("=");
                    317:        if (data[0] == name)
                    318:          return unescape(data[1]);
                    319:      }
                    320:      return null;
                    321:    }
1.338     sruby     322:   </script><link href="the-img-element.html" title="4.8.1 The img element" rel="prev">
                    323:   <link href="spec.html#contents" title="Table of contents" rel="contents">
1.146     mike      324:   <link href="the-embed-element.html" title="4.8.3 The embed element" rel="next">
1.167     mike      325:   </head><body onload="fixBrokenLink();" class="split chapter"><div class="head" id="head">
1.1       mike      326:    <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.3       mike      327: 
1.1       mike      328:    <h1>HTML5</h1>
1.338     sruby     329:    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
1.340   ! sruby     330:    <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 9 October 2012</h2>
1.230     mike      331:    </div>
1.338     sruby     332:    <div class="prev_next">
1.146     mike      333:    <a href="the-img-element.html">&#8592; 4.8.1 The img element</a> &#8211;
1.338     sruby     334:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.146     mike      335:    <a href="the-embed-element.html">4.8.3 The embed element &#8594;</a>
1.338     sruby     336:   </div>
1.1       mike      337: 
1.230     mike      338:   <h4 id="the-iframe-element"><span class="secno">4.8.2 </span>The <dfn><code>iframe</code></dfn> element</h4>
                    339: 
                    340:   <dl class="element"><dt><a href="element-definitions.html#element-dfn-categories" title="element-dfn-categories">Categories</a>:</dt>
1.304     sruby     341:    <dd><a href="content-models.html#flow-content-1">Flow content</a>.</dd>
                    342:    <dd><a href="content-models.html#phrasing-content-1">Phrasing content</a>.</dd>
                    343:    <dd><a href="content-models.html#embedded-content-2">Embedded content</a>.</dd>
                    344:    <dd><a href="content-models.html#interactive-content-0">Interactive content</a>.</dd>
                    345:    <dd><a href="content-models.html#palpable-content-0">Palpable content</a>.</dd>
1.170     mike      346:    <dt><a href="element-definitions.html#element-dfn-contexts" title="element-dfn-contexts">Contexts in which this element can be used</a>:</dt>
1.304     sruby     347:    <dd>Where <a href="content-models.html#embedded-content-2">embedded content</a> is expected.</dd>
1.170     mike      348:    <dt><a href="element-definitions.html#element-dfn-content-model" title="element-dfn-content-model">Content model</a>:</dt>
1.18      mike      349:    <dd>Text that conforms to <a href="#iframe-content-model">the requirements given in the prose</a>.</dd>
1.170     mike      350:    <dt><a href="element-definitions.html#element-dfn-attributes" title="element-dfn-attributes">Content attributes</a>:</dt>
1.146     mike      351:    <dd><a href="global-attributes.html#global-attributes">Global attributes</a></dd>
1.1       mike      352:    <dd><code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code></dd>
                    353:    <dd><code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code></dd>
                    354:    <dd><code title="attr-iframe-name"><a href="#attr-iframe-name">name</a></code></dd>
                    355:    <dd><code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code></dd>
                    356:    <dd><code title="attr-iframe-seamless"><a href="#attr-iframe-seamless">seamless</a></code></dd>
1.146     mike      357:    <dd><code title="attr-dim-width"><a href="dimension-attributes.html#attr-dim-width">width</a></code></dd>
                    358:    <dd><code title="attr-dim-height"><a href="dimension-attributes.html#attr-dim-height">height</a></code></dd>
1.304     sruby     359:    <dt><a href="element-definitions.html#element-dfn-dom" title="element-dfn-dom">DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
1.1       mike      360:    <dd>
                    361: <pre class="idl">interface <dfn id="htmliframeelement">HTMLIFrameElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
                    362:            attribute DOMString <a href="#dom-iframe-src" title="dom-iframe-src">src</a>;
                    363:            attribute DOMString <a href="#dom-iframe-srcdoc" title="dom-iframe-srcdoc">srcdoc</a>;
                    364:            attribute DOMString <a href="#dom-iframe-name" title="dom-iframe-name">name</a>;
1.81      mike      365:   [PutForwards=<span title="dom-DOMSettableTokenList-value">value</span>] readonly attribute <a href="infrastructure.html#domsettabletokenlist">DOMSettableTokenList</a> <a href="#dom-iframe-sandbox" title="dom-iframe-sandbox">sandbox</a>;
1.1       mike      366:            attribute boolean <a href="#dom-iframe-seamless" title="dom-iframe-seamless">seamless</a>;
1.146     mike      367:            attribute DOMString <a href="dimension-attributes.html#dom-dim-width" title="dom-dim-width">width</a>;
                    368:            attribute DOMString <a href="dimension-attributes.html#dom-dim-height" title="dom-dim-height">height</a>;
1.68      mike      369:   readonly attribute Document? <a href="#dom-iframe-contentdocument" title="dom-iframe-contentDocument">contentDocument</a>;
1.338     sruby     370:   readonly attribute <a href="textFieldSelection.html#windowproxy">WindowProxy</a>? <a href="#dom-iframe-contentwindow" title="dom-iframe-contentWindow">contentWindow</a>;
1.1       mike      371: };</pre>
                    372:    </dd>
1.338     sruby     373:   </dl><!--TOPIC:HTML--><p>The <code><a href="#the-iframe-element">iframe</a></code> element <a href="textFieldSelection.html#represents">represents</a> a
                    374:   <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a>.</p>
1.230     mike      375: 
                    376:   <p>The <dfn id="attr-iframe-src" title="attr-iframe-src"><code>src</code></dfn> attribute
1.338     sruby     377:   gives the address of a page that the <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.1       mike      378:   context</a> is to contain. The attribute, if present, must be a
                    379:   <a href="urls.html#valid-non-empty-url-potentially-surrounded-by-spaces">valid non-empty URL potentially surrounded by
1.230     mike      380:   spaces</a>.</p>
                    381: 
1.304     sruby     382: <!--MD-->
1.230     mike      383: 
                    384:   <p>The <dfn id="attr-iframe-srcdoc" title="attr-iframe-srcdoc"><code>srcdoc</code></dfn>
1.338     sruby     385:   attribute gives the content of the page that the <a href="textFieldSelection.html#nested-browsing-context">nested
1.32      mike      386:   browsing context</a> is to contain. The value of the attribute is
1.230     mike      387:   the source of <dfn id="an-iframe-srcdoc-document">an <code>iframe</code> <code title="attr-iframe-srcdoc">srcdoc</code> document</dfn>.</p>
                    388: 
                    389:   <p>For <code><a href="#the-iframe-element">iframe</a></code> elements in <a href="infrastructure.html#html-documents">HTML documents</a>,
1.338     sruby     390:   the attribute, if present, must have a value using <a href="textFieldSelection.html#syntax">the HTML
1.1       mike      391:   syntax</a> that consists of the following syntactic components,
1.230     mike      392:   in the given order:</p>
                    393: 
1.338     sruby     394:   <ol><li>Any number of <a href="textFieldSelection.html#syntax-comments" title="syntax-comments">comments</a> and
1.1       mike      395:    <a href="common-microsyntaxes.html#space-character" title="space character">space characters</a>.</li>
                    396: 
1.338     sruby     397:    <li>Optionally, a <a href="textFieldSelection.html#syntax-doctype" title="syntax-doctype">DOCTYPE</a>.
1.1       mike      398: 
1.338     sruby     399:    </li><li>Any number of <a href="textFieldSelection.html#syntax-comments" title="syntax-comments">comments</a> and
1.1       mike      400:    <a href="common-microsyntaxes.html#space-character" title="space character">space characters</a>.</li>
                    401: 
1.338     sruby     402:    <li>The root element, in the form of an <code><a href="the-html-element.html#the-html-element">html</a></code> <a href="textFieldSelection.html#syntax-elements" title="syntax-elements">element</a>.</li>
1.1       mike      403: 
1.338     sruby     404:    <li>Any number of <a href="textFieldSelection.html#syntax-comments" title="syntax-comments">comments</a> and
1.1       mike      405:    <a href="common-microsyntaxes.html#space-character" title="space character">space characters</a>.</li>
                    406: 
1.82      mike      407:   </ol><p>For <code><a href="#the-iframe-element">iframe</a></code> elements in <a href="infrastructure.html#xml-documents">XML documents</a>,
1.1       mike      408:   the attribute, if present, must have a value that matches the
1.324     sruby     409:   production labeled <code title="">document</code> in the XML
1.338     sruby     410:   specification. <a href="textFieldSelection.html#refsXML">[XML]</a></p>
1.230     mike      411: 
                    412:   <p>If the <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute and the
1.1       mike      413:   <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute are both
                    414:   specified together, the <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code>
                    415:   attribute takes priority. This allows authors to provide a fallback
                    416:   <a href="urls.html#url">URL</a> for legacy user agents that do not support the
1.230     mike      417:   <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute.</p>
                    418: 
                    419:   <div class="impl">
1.1       mike      420: 
1.299     mike      421:   <p>When an <code><a href="#the-iframe-element">iframe</a></code> element is <a href="infrastructure.html#insert-an-element-into-a-document" title="insert an
                    422:   element into a document">inserted into a document</a>, the user
1.338     sruby     423:   agent must create a <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a>, and then
1.299     mike      424:   <a href="#process-the-iframe-attributes">process the <code>iframe</code> attributes</a> for the
1.1       mike      425:   first time.</p>
                    426: 
1.299     mike      427:   <p>When an <code><a href="#the-iframe-element">iframe</a></code> element is <a href="infrastructure.html#remove-an-element-from-a-document" title="remove an
                    428:   element from a document">removed from a document</a>, the user
1.338     sruby     429:   agent must <a href="textFieldSelection.html#a-browsing-context-is-discarded" title="a browsing context is
                    430:   discarded">discard</a> the <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.299     mike      431:   context</a>.</p>
                    432: 
1.338     sruby     433:   <p class="note">This happens without any <code title="event-unload">unload</code> events firing (the <a href="textFieldSelection.html#nested-browsing-context">nested
                    434:   browsing context</a> and its <code><a href="dom.html#document">Document</a></code> are <em title="a browsing context is discarded"><a href="textFieldSelection.html#a-browsing-context-is-discarded">discarded</a></em>, not <em title="unload a document"><a href="textFieldSelection.html#unload-a-document">unloaded</a></em>).</p>
1.299     mike      435: 
1.338     sruby     436:   <!-- START of section that's very similar to <frame> -->
                    437: 
                    438:   <p>Whenever an <code><a href="#the-iframe-element">iframe</a></code> element with a <a href="textFieldSelection.html#nested-browsing-context">nested
1.32      mike      439:   browsing context</a> has its <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute set, changed, or
                    440:   removed, the user agent must <a href="#process-the-iframe-attributes">process the <code>iframe</code>
1.1       mike      441:   attributes</a>.</p>
                    442: 
                    443:   <p>Similarly, whenever an <code><a href="#the-iframe-element">iframe</a></code> element with a
1.338     sruby     444:   <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> but with no <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute specified has its
1.32      mike      445:   <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute set, changed, or
                    446:   removed, the user agent must <a href="#process-the-iframe-attributes">process the <code>iframe</code>
1.304     sruby     447:   attributes</a>.</p> <!-- It doesn't happen when the base URL is
                    448:   changed, though. -->
1.149     mike      449: 
1.1       mike      450:   <p>When the user agent is to <dfn id="process-the-iframe-attributes">process the <code>iframe</code>
                    451:   attributes</dfn>, it must run the first appropriate steps from the
                    452:   following list:</p>
                    453: 
                    454:   <dl class="switch"><dt>If the <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute
                    455:    is specified</dt>
                    456: 
1.338     sruby     457:    <dd><p><a href="textFieldSelection.html#navigate">Navigate</a><!--DONAV iframe--> the element's
                    458:    <a href="textFieldSelection.html#child-browsing-context">child browsing context</a> to a resource whose
                    459:    <a href="urls.html#content-type">Content-Type</a> is <code><a href="textFieldSelection.html#text/html">text/html</a></code>, whose
1.34      mike      460:    <a href="urls.html#url">URL</a> is <code><a href="urls.html#about:srcdoc">about:srcdoc</a></code>, and whose data
                    461:    consists of the value of the attribute. The resulting
1.145     mike      462:    <code><a href="dom.html#document">Document</a></code> must be considered <a href="#an-iframe-srcdoc-document">an
1.34      mike      463:    <code>iframe</code> <code title="attr-iframe-srcdoc">srcdoc</code>
                    464:    document</a>.</p></dd>
1.1       mike      465: 
1.338     sruby     466:    <dt>Otherwise, if the element has no <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute specified, and the
                    467:    user agent is processing the <code><a href="#the-iframe-element">iframe</a></code>'s attributes for
                    468:    the first time</dt>
1.1       mike      469: 
                    470:    <dd>
                    471: 
1.338     sruby     472:     <p><a href="textFieldSelection.html#queue-a-task">Queue a task</a> to <a href="textFieldSelection.html#fire-a-simple-event">fire a simple event</a>
                    473:     named <code title="event-load">load</code> at the
                    474:     <code><a href="#the-iframe-element">iframe</a></code> element.</p>
1.1       mike      475: 
                    476:    </dd>
                    477: 
                    478:    <dt>Otherwise</dt>
                    479: 
                    480:    <dd>
                    481: 
1.338     sruby     482:     <ol><li>
                    483: 
                    484:       <p>If the value of the <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code>
                    485:       attribute is the empty string, let <var title="">url</var> be
                    486:       the string "<code><a href="urls.html#about:blank">about:blank</a></code>".</p>
                    487: 
                    488:       <p>Otherwise, <a href="urls.html#resolve-a-url" title="resolve a url">resolve</a> the
                    489:       value of the <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute,
                    490:       relative to the <code><a href="#the-iframe-element">iframe</a></code> element.</p>
                    491: 
                    492:       <p>If that is not successful, then let <var title="">url</var>
                    493:       be the string "<code><a href="urls.html#about:blank">about:blank</a></code>". Otherwise, let <var title="">url</var> be the resulting <a href="urls.html#absolute-url">absolute
                    494:       URL</a>.</p>
                    495: 
                    496:      </li>
                    497: 
                    498:      <li>
                    499: 
                    500:       <p><a href="textFieldSelection.html#navigate">Navigate</a><!--DONAV iframe--> the element's
                    501:       <a href="textFieldSelection.html#child-browsing-context">child browsing context</a> to <var title="">url</var>.</p>
                    502:       
                    503:      </li>
1.1       mike      504: 
1.338     sruby     505:     </ol></dd>
1.1       mike      506: 
1.338     sruby     507:   </dl><p>Any <a href="textFieldSelection.html#navigate" title="navigate">navigation</a> required of the user
1.1       mike      508:   agent in the <a href="#process-the-iframe-attributes">process the <code>iframe</code> attributes</a>
1.338     sruby     509:   algorithm must be completed as an <a href="textFieldSelection.html#explicit-self-navigation-override">explicit self-navigation
1.316     sruby     510:   override</a> and with the <code><a href="#the-iframe-element">iframe</a></code> element's
1.338     sruby     511:   document's <a href="textFieldSelection.html#browsing-context">browsing context</a> as the <a href="textFieldSelection.html#source-browsing-context">source
1.1       mike      512:   browsing context</a>.</p>
                    513: 
1.338     sruby     514:   <p>Furthermore, if the <a href="textFieldSelection.html#active-document">active document</a> of the element's
                    515:   <a href="textFieldSelection.html#child-browsing-context">child browsing context</a> before such a <a href="textFieldSelection.html#navigate" title="navigate">navigation</a> was not <a href="textFieldSelection.html#completely-loaded">completely
                    516:   loaded</a> at the time of the new <a href="textFieldSelection.html#navigate" title="navigate">navigation</a>, then the <a href="textFieldSelection.html#navigate" title="navigate">navigation</a> must be completed with
                    517:   <a href="textFieldSelection.html#replacement-enabled">replacement enabled</a>.</p>
                    518: 
                    519:   <p>Similarly, if the <a href="textFieldSelection.html#child-browsing-context">child browsing context</a>'s
                    520:   <a href="textFieldSelection.html#session-history">session history</a> contained only one
                    521:   <code><a href="dom.html#document">Document</a></code> when the <a href="#process-the-iframe-attributes">process the <code>iframe</code>
                    522:   attributes</a> algorithm was invoked, and that was the
                    523:   <code><a href="urls.html#about:blank">about:blank</a></code> <code><a href="dom.html#document">Document</a></code> created when the
                    524:   <a href="textFieldSelection.html#child-browsing-context">child browsing context</a> was created, then any <a href="textFieldSelection.html#navigate" title="navigate">navigation</a> required of the user agent in
                    525:   that algorithm must be completed with <a href="textFieldSelection.html#replacement-enabled">replacement
                    526:   enabled</a>.</p> <!-- see also the note near similar text for the
                    527:   location.assign() method -->
1.149     mike      528: 
1.230     mike      529:   </div>
                    530: 
1.338     sruby     531:   <!-- END of section that's very similar to <frame> -->
                    532: 
1.230     mike      533:   <p class="note">If, when the element is created, the <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute is not set, and
1.1       mike      534:   the <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute is either
                    535:   also not set or set but its value cannot be <a href="urls.html#resolve-a-url" title="resolve a
                    536:   url">resolved</a>, the browsing context will remain at the
1.230     mike      537:   initial <code><a href="urls.html#about:blank">about:blank</a></code> page.</p>
                    538: 
1.338     sruby     539:   <p class="note">If the user <a href="textFieldSelection.html#navigate" title="navigate">navigates</a>
1.1       mike      540:   away from this page, the <code><a href="#the-iframe-element">iframe</a></code>'s corresponding
1.338     sruby     541:   <code><a href="textFieldSelection.html#windowproxy">WindowProxy</a></code> object will proxy new <code><a href="textFieldSelection.html#window">Window</a></code>
1.230     mike      542:   objects for new <code><a href="dom.html#document">Document</a></code> objects, but the <code title="attr-iframe-src"><a href="#attr-iframe-src">src</a></code> attribute will not change.</p>
                    543: 
                    544:   <div class="example">
1.1       mike      545: 
                    546:    <p>Here a blog uses the <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute in conjunction
                    547:    with the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> and <code title="attr-iframe-seamless"><a href="#attr-iframe-seamless">seamless</a></code> attributes described
                    548:    below to provide users of user agents that support this feature
                    549:    with an extra layer of protection from script injection in the blog
                    550:    post comments:</p>
                    551: 
                    552:    <pre>&lt;article&gt;
                    553:  &lt;h1&gt;I got my own magazine!&lt;/h1&gt;
                    554:  &lt;p&gt;After much effort, I've finally found a publisher, and so now I
                    555:  have my own magazine! Isn't that awesome?! The first issue will come
                    556:  out in September, and we have articles about getting food, and about
                    557:  getting in boxes, it's going to be great!&lt;/p&gt;
                    558:  &lt;footer&gt;
1.145     mike      559:   &lt;p&gt;Written by &lt;a href="/users/cap"&gt;cap&lt;/a&gt;, 1 hour ago.
1.1       mike      560:  &lt;/footer&gt;
                    561:  &lt;article&gt;
1.145     mike      562:   &lt;footer&gt; Thirteen minutes ago, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; wrote: &lt;/footer&gt;
1.33      mike      563:   &lt;iframe seamless sandbox srcdoc="&lt;p&gt;did you get a cover picture yet?"&gt;&lt;/iframe&gt;
1.1       mike      564:  &lt;/article&gt;
                    565:  &lt;article&gt;
1.145     mike      566:   &lt;footer&gt; Nine minutes ago, &lt;a href="/users/cap"&gt;cap&lt;/a&gt; wrote: &lt;/footer&gt;
1.33      mike      567:   &lt;iframe seamless sandbox srcdoc="&lt;p&gt;Yeah, you can see it &lt;a href=&amp;quot;/gallery?mode=cover&amp;amp;amp;page=1&amp;quot;&gt;in my gallery&lt;/a&gt;."&gt;&lt;/iframe&gt;
1.1       mike      568:  &lt;/article&gt;
                    569:  &lt;article&gt;
1.145     mike      570:   &lt;footer&gt; Five minutes ago, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; wrote: &lt;/footer&gt;
1.33      mike      571:   &lt;iframe seamless sandbox srcdoc="&lt;p&gt;hey that's earl's table.
1.1       mike      572: &lt;p&gt;you should get earl&amp;amp;amp;me on the next cover."&gt;&lt;/iframe&gt;
                    573:  &lt;/article&gt;</pre>
                    574: 
                    575:    <p>Notice the way that quotes have to be escaped (otherwise the
1.101     mike      576:    <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute would end
                    577:    prematurely), and the way raw ampersands (e.g. in URLs or in prose)
                    578:    mentioned in the sandboxed content have to be <em>doubly</em>
                    579:    escaped &#8212; once so that the ampersand is preserved when
                    580:    originally parsing the <code title="attr-iframe-srcdoc"><a href="#attr-iframe-srcdoc">srcdoc</a></code> attribute, and once more
1.1       mike      581:    to prevent the ampersand from being misinterpreted when parsing the
                    582:    sandboxed content.</p>
                    583: 
1.230     mike      584:   </div>
                    585: 
1.338     sruby     586:   <p class="note">In <a href="textFieldSelection.html#syntax">the HTML syntax</a>, authors need only
1.230     mike      587:   remember to use """ (U+0022) characters to wrap the
                    588:   attribute contents and then to escape all """ (U+0022)
1.1       mike      589:   and U+0026 AMPERSAND (&amp;) characters, and to specify the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attribute, to ensure safe
1.230     mike      590:   embedding of content.</p>
                    591: 
1.338     sruby     592:   <p class="note">Due to restrictions of <a href="textFieldSelection.html#the-xhtml-syntax">the XHTML
1.141     mike      593:   syntax</a>, in XML the U+003C LESS-THAN SIGN character (&lt;)
                    594:   needs to be escaped as well. In order to prevent <a href="http://www.w3.org/TR/REC-xml/#AVNormalize">attribute-value
1.39      mike      595:   normalization</a>, some of XML's whitespace characters &#8212;
1.230     mike      596:   specifically "tab" (U+0009), "LF" (U+000A), and "CR" (U+000D) &#8212; also need to be
1.338     sruby     597:   escaped. <a href="textFieldSelection.html#refsXML">[XML]</a></p>
1.230     mike      598: 
                    599:   <hr><p>The <dfn id="attr-iframe-name" title="attr-iframe-name"><code>name</code></dfn>
1.338     sruby     600:   attribute, if present, must be a <a href="textFieldSelection.html#valid-browsing-context-name">valid browsing context
                    601:   name</a>. The given value is used to name the <a href="textFieldSelection.html#nested-browsing-context">nested
1.1       mike      602:   browsing context</a>. <span class="impl">When the browsing
1.338     sruby     603:   context is created, if the attribute is present, the <a href="textFieldSelection.html#browsing-context-name">browsing
1.1       mike      604:   context name</a> must be set to the value of this attribute;
1.338     sruby     605:   otherwise, the <a href="textFieldSelection.html#browsing-context-name">browsing context name</a> must be set to the
1.230     mike      606:   empty string.</span></p>
                    607: 
                    608:   <div class="impl">
1.1       mike      609: 
                    610:   <p>Whenever the <code title="attr-iframe-name"><a href="#attr-iframe-name">name</a></code> attribute
1.338     sruby     611:   is set, the nested <a href="textFieldSelection.html#browsing-context">browsing context</a>'s <a href="textFieldSelection.html#browsing-context-name" title="browsing context name">name</a> must be changed to the new
                    612:   value. If the attribute is removed, the <a href="textFieldSelection.html#browsing-context-name">browsing context
1.1       mike      613:   name</a> must be set to the empty string.</p>
                    614: 
                    615:   <p>When content loads in an <code><a href="#the-iframe-element">iframe</a></code>, after any <code title="event-load">load</code> events are fired within the content
1.338     sruby     616:   itself, the user agent must <a href="textFieldSelection.html#queue-a-task">queue a task</a> to <a href="textFieldSelection.html#fire-a-simple-event">fire
1.1       mike      617:   a simple event</a> named <code title="event-load">load</code> at
                    618:   the <code><a href="#the-iframe-element">iframe</a></code> element. When content whose <a href="urls.html#url">URL</a>
1.338     sruby     619:   has the <a href="textFieldSelection.html#same-origin">same origin</a> as the <code><a href="#the-iframe-element">iframe</a></code>
1.145     mike      620:   element's <code><a href="dom.html#document">Document</a></code> fails to load (e.g. due to a DNS
1.1       mike      621:   error, network error, or if the server returned a 4xx or 5xx status
1.146     mike      622:   code <a href="urls.html#concept-http-equivalent-codes" title="concept-http-equivalent-codes">or
1.338     sruby     623:   equivalent</a>), then the user agent must <a href="textFieldSelection.html#queue-a-task">queue a
                    624:   task</a> to <a href="textFieldSelection.html#fire-a-simple-event">fire a simple event</a> named <code title="event-error">error</code> at the element instead. (This event
                    625:   does not fire for <a href="textFieldSelection.html#parse-error" title="parse error">parse errors</a>,
1.1       mike      626:   script errors, or any errors for cross-origin resources.)</p>
                    627: 
1.338     sruby     628:   <p>The <a href="textFieldSelection.html#task-source">task source</a> for these <a href="textFieldSelection.html#concept-task" title="concept-task">tasks</a> is the <a href="textFieldSelection.html#dom-manipulation-task-source">DOM manipulation
1.1       mike      629:   task source</a>.</p>
                    630: 
                    631:   <p class="note">A <code title="event-load">load</code> event is also
                    632:   fired at the <code><a href="#the-iframe-element">iframe</a></code> element when it is created if no
                    633:   other data is loaded in it.</p>
                    634: 
1.338     sruby     635:   <p>When the <code><a href="#the-iframe-element">iframe</a></code>'s <a href="textFieldSelection.html#active-document">active document</a> is
                    636:   not <a href="textFieldSelection.html#ready-for-post-load-tasks">ready for post-load tasks</a>, and when anything in the
                    637:   <code><a href="#the-iframe-element">iframe</a></code> is <a href="textFieldSelection.html#delay-the-load-event" title="delay the load event">delaying
                    638:   the load event</a> of the <code><a href="#the-iframe-element">iframe</a></code>'s <a href="textFieldSelection.html#browsing-context">browsing
                    639:   context</a>'s <a href="textFieldSelection.html#active-document">active document</a>, the
                    640:   <code><a href="#the-iframe-element">iframe</a></code> must <a href="textFieldSelection.html#delay-the-load-event">delay the load event</a> of its
1.334     sruby     641:   document.</p>
1.1       mike      642: 
1.338     sruby     643:   <p class="note">If, during the handling of the <code title="event-load">load</code> event, the <a href="textFieldSelection.html#browsing-context">browsing
                    644:   context</a> in the <code><a href="#the-iframe-element">iframe</a></code> is again <a href="textFieldSelection.html#navigate" title="navigate">navigated</a>, that will further <a href="textFieldSelection.html#delay-the-load-event">delay the
1.1       mike      645:   load event</a>.</p>
                    646: 
1.230     mike      647:   </div>
                    648: 
                    649:   <hr><p>The <dfn id="attr-iframe-sandbox" title="attr-iframe-sandbox"><code>sandbox</code></dfn>
1.1       mike      650:   attribute, when specified, enables a set of extra restrictions on
                    651:   any content hosted by the <code><a href="#the-iframe-element">iframe</a></code>. Its value must be an
1.20      mike      652:   <a href="common-microsyntaxes.html#unordered-set-of-unique-space-separated-tokens">unordered set of unique space-separated tokens</a> that are
1.77      mike      653:   <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a>. The allowed values are
1.338     sruby     654:   <code title="attr-iframe-sandbox-allow-forms"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-forms">allow-forms</a></code>,
                    655:   <code title="attr-iframe-sandbox-allow-popups"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-popups">allow-popups</a></code>,
                    656:   <code title="attr-iframe-sandbox-allow-same-origin"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-same-origin">allow-same-origin</a></code>,
                    657:   <code title="attr-iframe-sandbox-allow-scripts"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-scripts">allow-scripts</a></code>, and
                    658:   <code title="attr-iframe-sandbox-allow-top-navigation"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</a></code>.
1.77      mike      659: 
                    660:   When the attribute is set, the content is treated as being from a
1.338     sruby     661:   unique <a href="textFieldSelection.html#origin-0">origin</a>, forms and scripts are disabled, links
                    662:   are prevented from targeting other <a href="textFieldSelection.html#browsing-context" title="browsing
1.114     mike      663:   context">browsing contexts</a>, and plugins are secured. The
1.338     sruby     664:   <code title="attr-iframe-sandbox-allow-same-origin"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-same-origin">allow-same-origin</a></code>
1.1       mike      665:   keyword allows the content to be treated as being from the same
1.338     sruby     666:   origin instead of forcing it into a unique origin, the <code title="attr-iframe-sandbox-allow-top-navigation"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</a></code>
                    667:   keyword allows the content to <a href="textFieldSelection.html#navigate">navigate</a> its
                    668:   <a href="textFieldSelection.html#top-level-browsing-context">top-level browsing context</a>, and the <code title="attr-iframe-sandbox-allow-forms"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-forms">allow-forms</a></code>, <code title="attr-iframe-sandbox-allow-popups"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-popups">allow-popups</a></code> and <code title="attr-iframe-sandbox-allow-scripts"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-scripts">allow-scripts</a></code>
1.254     mike      669:   keywords re-enable forms, popups, and scripts respectively.</p>
1.230     mike      670: 
                    671:   <p class="warning">Setting both the
1.338     sruby     672:   <code title="attr-iframe-sandbox-allow-scripts"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-scripts">allow-scripts</a></code> and
                    673:   <code title="attr-iframe-sandbox-allow-same-origin"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-same-origin">allow-same-origin</a></code>
                    674:   keywords together when the embedded page has the <a href="textFieldSelection.html#same-origin">same
1.1       mike      675:   origin</a> as the page containing the <code><a href="#the-iframe-element">iframe</a></code> allows
1.230     mike      676:   the embedded page to simply remove the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attribute.</p>
                    677: 
                    678:   <p class="warning">Sandboxing hostile content is of minimal help if
1.1       mike      679:   an attacker can convince the user to just visit the hostile content
                    680:   directly, rather than in the <code><a href="#the-iframe-element">iframe</a></code>. To limit the
                    681:   damage that can be caused by hostile HTML content, it should be
1.230     mike      682:   served from a separate dedicated domain.</p>
                    683: 
                    684:   <div class="impl">
1.1       mike      685: 
1.304     sruby     686:   <!-- v2: Add a new attribute that enables new restrictions, e.g.:
                    687:        - disallow cross-origin loads of any kind (networking
                    688:          override that only allows same-origin URLs or about:,
                    689:          javascript:, data:)
                    690:        - block access to 'parent.frames' from sandbox
                    691:   -->
1.149     mike      692: 
1.1       mike      693:   <p>While the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code>
1.338     sruby     694:   attribute is set or changed, the user agent must <a href="textFieldSelection.html#parse-a-sandboxing-directive" title="parse
1.253     mike      695:   a sandboxing directive">parse the sandboxing directive</a> using
                    696:   the attribute's value as the <var title="">input</var> and the
1.338     sruby     697:   <code><a href="#the-iframe-element">iframe</a></code> element's <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a>'s
                    698:   <a href="textFieldSelection.html#iframe-sandboxing-flag-set"><code>iframe</code> sandboxing flag set</a> as the
1.253     mike      699:   output.</p>
1.1       mike      700: 
                    701:   <p class="warning">These flags only take effect when the
1.338     sruby     702:   <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> of the <code><a href="#the-iframe-element">iframe</a></code> is
                    703:   <a href="textFieldSelection.html#navigate" title="navigate">navigated</a>. Removing them, or removing
1.1       mike      704:   the entire <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code>
                    705:   attribute, has no effect on an already-loaded page.</p>
                    706: 
1.230     mike      707:   </div>
                    708: 
                    709:   <div class="example">
1.1       mike      710: 
                    711:    <p>In this example, some completely-unknown, potentially hostile,
                    712:    user-provided HTML content is embedded in a page. Because it is
1.127     mike      713:    served from a separate domain, it is affected by all the normal
                    714:    cross-site restrictions. In addition, the embedded page has
                    715:    scripting disabled, plugins disabled, forms disabled, and it cannot
                    716:    navigate any frames or windows other than itself (or any frames or
                    717:    windows it itself embeds).</p>
1.1       mike      718: 
                    719:    <pre>&lt;p&gt;We're not scared of you! Here is your content, unedited:&lt;/p&gt;
1.127     mike      720: &lt;iframe sandbox src="http://usercontent.example.net/getusercontent.cgi?id=12193"&gt;&lt;/iframe&gt;</pre>
1.1       mike      721: 
1.127     mike      722:    <p class="warning">It is important to use a separate domain so that
                    723:    if the attacker convinces the user to visit that page directly, the
                    724:    page doesn't run in the context of the site's origin, which would
                    725:    make the user vulnerable to any attack found in the page.</p>
1.1       mike      726: 
1.230     mike      727:   </div>
                    728: 
                    729:   <div class="example">
1.1       mike      730: 
                    731:    <p>In this example, a gadget from another site is embedded. The
                    732:    gadget has scripting and forms enabled, and the origin sandbox
                    733:    restrictions are lifted, allowing the gadget to communicate with
                    734:    its originating server. The sandbox is still useful, however, as it
                    735:    disables plugins and popups, thus reducing the risk of the user
                    736:    being exposed to malware and other annoyances.</p>
                    737: 
                    738:    <pre>&lt;iframe sandbox="allow-same-origin allow-forms allow-scripts"
                    739:         src="http://maps.example.com/embedded.html"&gt;&lt;/iframe&gt;</pre>
                    740: 
1.230     mike      741:   </div>
                    742: 
                    743:   <div class="example">
1.1       mike      744: 
                    745:    <p>Suppose a file A contained the following fragment:</p>
                    746: 
                    747:    <pre>&lt;iframe sandbox="allow-same-origin allow-forms" src=B&gt;&lt;/iframe&gt;</pre>
                    748: 
                    749:    <p>Suppose that file B contained an iframe also:</p>
                    750: 
                    751:    <pre>&lt;iframe sandbox="allow-scripts" src=C&gt;&lt;/iframe&gt;</pre>
                    752: 
                    753:    <p>Further, suppose that file C contained a link:</p>
                    754: 
                    755:    <pre>&lt;a href=D&gt;Link&lt;/a&gt;</pre>
                    756: 
                    757:    <p>For this example, suppose all the files were served as
1.338     sruby     758:    <code><a href="textFieldSelection.html#text/html">text/html</a></code>.</p>
1.1       mike      759: 
                    760:    <p>Page C in this scenario has all the sandboxing flags
                    761:    set. Scripts are disabled, because the <code><a href="#the-iframe-element">iframe</a></code> in A has
1.338     sruby     762:    scripts disabled, and this overrides the <code title="attr-iframe-sandbox-allow-scripts"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-scripts">allow-scripts</a></code>
1.1       mike      763:    keyword set on the <code><a href="#the-iframe-element">iframe</a></code> in B. Forms are also
                    764:    disabled, because the inner <code><a href="#the-iframe-element">iframe</a></code> (in B) does not
1.338     sruby     765:    have the <code title="attr-iframe-sandbox-allow-forms"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-forms">allow-forms</a></code> keyword
1.1       mike      766:    set.</p>
                    767: 
1.142     mike      768:    <p>Suppose now that a script in A removes all the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attributes in A
1.304     sruby     769:    <!--grammar-check-override--> and B. This would change nothing
1.142     mike      770:    immediately. If the user clicked the link in C, loading page D into
                    771:    the <code><a href="#the-iframe-element">iframe</a></code> in B, page D would now act as if the
1.338     sruby     772:    <code><a href="#the-iframe-element">iframe</a></code> in B had the <code title="attr-iframe-sandbox-allow-same-origin"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-same-origin">allow-same-origin</a></code>
                    773:    and <code title="attr-iframe-sandbox-allow-forms"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-forms">allow-forms</a></code> keywords
                    774:    set, because that was the state of the <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.1       mike      775:    context</a> in the <code><a href="#the-iframe-element">iframe</a></code> in A when page B was
                    776:    loaded.</p>
                    777: 
                    778:    <p>Generally speaking, dynamically removing or changing the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attribute is
                    779:    ill-advised, because it can make it quite hard to reason about what
                    780:    will be allowed and what will not.</p>
                    781: 
1.230     mike      782:   </div>
                    783: 
                    784:   <p class="note">Potentially hostile files should not be served from
1.127     mike      785:   the same server as the file containing the <code><a href="#the-iframe-element">iframe</a></code>
                    786:   element. Using a different domain ensures that scripts in the files
                    787:   are unable to attack the site, even if the user is tricked into
1.230     mike      788:   visiting those pages directly, without the protection of the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attribute.</p>
                    789: 
1.338     sruby     790:   <p class="warning">If the <code title="attr-iframe-sandbox-allow-scripts"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-scripts">allow-scripts</a></code>
                    791:   keyword is set along with <code title="attr-iframe-sandbox-allow-same-origin"><a href="textFieldSelection.html#attr-iframe-sandbox-allow-same-origin">allow-same-origin</a></code>
                    792:   keyword, and the file is from the <a href="textFieldSelection.html#same-origin">same origin</a> as the
1.145     mike      793:   <code><a href="#the-iframe-element">iframe</a></code>'s <code><a href="dom.html#document">Document</a></code>, then a script in the
1.1       mike      794:   "sandboxed" iframe could just reach out, remove the <code title="attr-iframe-sandbox"><a href="#attr-iframe-sandbox">sandbox</a></code> attribute, and then
                    795:   reload itself, effectively breaking out of the sandbox
1.230     mike      796:   altogether.</p>
                    797: 
                    798: 
1.304     sruby     799:   <hr><!-- v2: Might be interesting to have a value on seamless that
                    800:   allowed event propagation of some sort, maybe based on the WICD
                    801:   work: http://www.w3.org/TR/WICD/ --><p>The <dfn id="attr-iframe-seamless" title="attr-iframe-seamless"><code>seamless</code></dfn>
1.1       mike      802:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. When specified, it
1.338     sruby     803:   indicates that the <code><a href="#the-iframe-element">iframe</a></code> element's <a href="textFieldSelection.html#browsing-context">browsing
1.1       mike      804:   context</a> is to be rendered in a manner that makes it appear to
                    805:   be part of the containing document (seamlessly included in the
1.334     sruby     806:   parent document).</p>
1.230     mike      807: 
                    808:   <div class="impl">
1.1       mike      809: 
1.334     sruby     810:   <p>An <code><a href="#the-iframe-element">iframe</a></code> element is said to be <dfn id="in-seamless-mode">in seamless
                    811:   mode</dfn> when all of the following conditions are met:</p>
                    812: 
                    813:   <ul><li>The <code title="attr-iframe-seamless"><a href="#attr-iframe-seamless">seamless</a></code>
                    814:    attribute is set on the <code><a href="#the-iframe-element">iframe</a></code> element, and
                    815: 
                    816:    </li><li>The <code><a href="#the-iframe-element">iframe</a></code> element's owner <code><a href="dom.html#document">Document</a></code>'s
1.338     sruby     817:    <a href="textFieldSelection.html#active-sandboxing-flag-set">active sandboxing flag set</a> does not have the
                    818:    <a href="textFieldSelection.html#sandboxed-seamless-iframes-flag">sandboxed seamless iframes flag</a> set, and
1.334     sruby     819: 
                    820:    </li><li>Either:
                    821: 
1.338     sruby     822:     <ul><li>The <a href="textFieldSelection.html#browsing-context">browsing context</a>'s <a href="textFieldSelection.html#active-document">active
                    823:      document</a> has the <a href="textFieldSelection.html#same-origin">same origin</a> as the
1.334     sruby     824:      <code><a href="#the-iframe-element">iframe</a></code> element's <code><a href="dom.html#document">Document</a></code>, or
                    825: 
1.338     sruby     826:      </li><li>The <a href="textFieldSelection.html#browsing-context">browsing context</a>'s <a href="textFieldSelection.html#active-document">active
1.334     sruby     827:      document</a>'s <em><a href="the-address-element.html#the-address-element"><span title="the document's
1.338     sruby     828:      address">address</span></a></em> has the <a href="textFieldSelection.html#same-origin">same origin</a> as
1.334     sruby     829:      the <code><a href="#the-iframe-element">iframe</a></code> element's <code><a href="dom.html#document">Document</a></code>, or
                    830: 
1.338     sruby     831:      </li><li>The <a href="textFieldSelection.html#browsing-context">browsing context</a>'s <a href="textFieldSelection.html#active-document">active
1.334     sruby     832:      document</a> is <a href="#an-iframe-srcdoc-document">an <code>iframe</code> <code title="attr-iframe-srcdoc">srcdoc</code> document</a>.
                    833: 
                    834:     </li></ul></li>
                    835: 
                    836:   </ul><p>When an <code><a href="#the-iframe-element">iframe</a></code> element is <a href="#in-seamless-mode">in seamless
                    837:   mode</a>, the following requirements apply:</p>
                    838: 
1.13      mike      839:   <ul><li><p>The user agent must set the <dfn id="seamless-browsing-context-flag">seamless browsing context
1.338     sruby     840:    flag</dfn> to true for that <a href="textFieldSelection.html#browsing-context">browsing context</a>. This
                    841:    will <a href="textFieldSelection.html#seamlessLinks">cause links to open in the parent
                    842:    browsing context</a> unless an <a href="textFieldSelection.html#explicit-self-navigation-override">explicit self-navigation
1.13      mike      843:    override</a> is used (<code title="">target="_self"</code>).</p></li>
1.1       mike      844: 
1.334     sruby     845:    <li><p>Media queries in the context of the <code><a href="#the-iframe-element">iframe</a></code>'s
1.338     sruby     846:    <a href="textFieldSelection.html#browsing-context">browsing context</a> (e.g. on <code title="attr-style-media"><a href="the-style-element.html#attr-style-media">media</a></code> attributes of
1.334     sruby     847:    <code><a href="the-style-element.html#the-style-element">style</a></code> elements in <code><a href="dom.html#document">Document</a></code>s in that
                    848:    <code><a href="#the-iframe-element">iframe</a></code>) must be evaluated with respect to the nearest
1.338     sruby     849:    <a href="textFieldSelection.html#ancestor-browsing-context">ancestor browsing context</a> that is not itself being
                    850:    <a href="textFieldSelection.html#browsing-context-nested-through" title="browsing context nested through">nested through</a>
1.334     sruby     851:    an <code><a href="#the-iframe-element">iframe</a></code> that is <a href="#in-seamless-mode">in seamless
1.338     sruby     852:    mode</a>. <a href="textFieldSelection.html#refsMQ">[MQ]</a></p></li>
1.334     sruby     853: 
1.1       mike      854:    <li><p>In a CSS-supporting user agent: the user agent must add all
                    855:    the style sheets that apply to the <code><a href="#the-iframe-element">iframe</a></code> element to
1.338     sruby     856:    the cascade of the <a href="textFieldSelection.html#active-document">active document</a> of the
                    857:    <code><a href="#the-iframe-element">iframe</a></code> element's <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a>,
1.1       mike      858:    at the appropriate cascade levels, before any style sheets
                    859:    specified by the document itself.</p></li>
                    860: 
                    861:    <li><p>In a CSS-supporting user agent: the user agent must, for the
                    862:    purpose of CSS property inheritance only, treat the root element of
1.338     sruby     863:    the <a href="textFieldSelection.html#active-document">active document</a> of the <code><a href="#the-iframe-element">iframe</a></code>
                    864:    element's <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> as being a child of
1.1       mike      865:    the <code><a href="#the-iframe-element">iframe</a></code> element. (Thus inherited properties on the
                    866:    root element of the document in the <code><a href="#the-iframe-element">iframe</a></code> will
                    867:    inherit the computed values of those properties on the
                    868:    <code><a href="#the-iframe-element">iframe</a></code> element instead of taking their initial
                    869:    values.)</p></li>
                    870: 
1.316     sruby     871:    <li><p>In visual media, in a CSS-supporting user agent: the user
                    872:    agent should set the intrinsic width of the <code><a href="#the-iframe-element">iframe</a></code> to
                    873:    the width that the element would have if it was a non-replaced
                    874:    block-level element with 'width: auto', unless that width would be
                    875:    zero (e.g. if the element is floating or absolutely positioned), in
                    876:    which case the user agent should set the intrinsic width of the
                    877:    <code><a href="#the-iframe-element">iframe</a></code> to the shrink-to-fit width of the root element
                    878:    (if any) of the content rendered in the
                    879:    <code><a href="#the-iframe-element">iframe</a></code>.</p></li>
1.1       mike      880: 
                    881:    <li><p>In visual media, in a CSS-supporting user agent: the user
                    882:    agent should set the intrinsic height of the <code><a href="#the-iframe-element">iframe</a></code> to
1.334     sruby     883:    the shortest height that would make the content rendered in the
1.1       mike      884:    <code><a href="#the-iframe-element">iframe</a></code> at its current width (as given in the previous
1.334     sruby     885:    bullet point) have no scrollable overflow at its bottom edge<!--,
                    886:    if the scrolling position was such that the top of the viewport for
                    887:    the content rendered in the <code>iframe</code> was aligned with
                    888:    the origin of that content's canvas-->. Scrollable overflow is any
                    889:    overflow that would increase the range to which a scrollbar or
                    890:    other scrolling mechanism can scroll.</p></li>
1.1       mike      891: 
                    892:    <li>
                    893: 
                    894:     <p>In visual media, in a CSS-supporting user agent: the user agent
                    895:     must force the height of the initial containing block of the
1.338     sruby     896:     <a href="textFieldSelection.html#active-document">active document</a> of the <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.1       mike      897:     context</a> of the <code><a href="#the-iframe-element">iframe</a></code> to zero.</p>
                    898: 
                    899:     <p class="note">This is intended to get around the otherwise
                    900:     circular dependency of percentage dimensions that depend on the
                    901:     height of the containing block, thus affecting the height of the
                    902:     document's bounding box, thus affecting the height of the
                    903:     viewport, thus affecting the size of the initial containing
                    904:     block.</p>
                    905: 
                    906:    </li>
                    907: 
1.338     sruby     908:    <li><p>In speech media, the user agent should render the <a href="textFieldSelection.html#nested-browsing-context">nested
1.1       mike      909:    browsing context</a> without announcing that it is a separate
                    910:    document.</p></li>
                    911: 
                    912:    <li>
                    913: 
1.338     sruby     914:     <p>User agents should, in general, act as if the <a href="textFieldSelection.html#active-document">active
                    915:     document</a> of the <code><a href="#the-iframe-element">iframe</a></code>'s <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.1       mike      916:     context</a> was part of the document that the
1.35      mike      917:     <code><a href="#the-iframe-element">iframe</a></code> is in, if any.</p>
1.1       mike      918: 
                    919:     <p class="example">For example if the user agent supports listing
                    920:     all the links in a document, links in "seamlessly" nested
                    921:     documents would be included in that list without being
                    922:     significantly distinguished from links in the document itself.</p>
                    923: 
                    924:    </li>
                    925: 
1.338     sruby     926:   </ul><p>If the attribute is not specified, or if the <a href="textFieldSelection.html#origin-0">origin</a>
1.1       mike      927:   conditions listed above are not met, then the user agent should
1.338     sruby     928:   render the <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> in a manner that is
                    929:   clearly distinguishable as a separate <a href="textFieldSelection.html#browsing-context">browsing context</a>,
1.1       mike      930:   and the <a href="#seamless-browsing-context-flag">seamless browsing context flag</a> must be set to
1.338     sruby     931:   false for that <a href="textFieldSelection.html#browsing-context">browsing context</a>.</p>
1.1       mike      932: 
                    933:   <p class="warning">It is important that user agents recheck the
1.338     sruby     934:   above conditions whenever the <a href="textFieldSelection.html#active-document">active document</a> of the
                    935:   <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> of the <code><a href="#the-iframe-element">iframe</a></code>
1.1       mike      936:   changes, such that the <a href="#seamless-browsing-context-flag">seamless browsing context flag</a>
1.338     sruby     937:   gets unset if the <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a> is <a href="textFieldSelection.html#navigate" title="navigate">navigated</a> to another origin.</p>
1.1       mike      938: 
1.230     mike      939:   </div>
                    940: 
                    941:   <p class="note">The attribute can be set or removed dynamically,
                    942:   with the rendering updating in tandem.</p>
                    943: 
                    944:   <div class="example">
1.1       mike      945: 
                    946:    <p>In this example, the site's navigation is embedded using a
                    947:    client-side include using an <code><a href="#the-iframe-element">iframe</a></code>. Any links in the
                    948:    <code><a href="#the-iframe-element">iframe</a></code> will, in new user agents, be automatically
                    949:    opened in the <code><a href="#the-iframe-element">iframe</a></code>'s parent browsing context; for
1.146     mike      950:    legacy user agents, the site could also include a <code><a href="the-base-element.html#the-base-element">base</a></code>
                    951:    element with a <code title="attr-base-target"><a href="the-base-element.html#attr-base-target">target</a></code>
1.1       mike      952:    attribute with the value <code title="">_parent</code>. Similarly,
                    953:    in new user agents the styles of the parent page will be
                    954:    automatically applied to the contents of the frame, but to support
                    955:    legacy user agents authors might wish to include the styles
                    956:    explicitly.</p>
                    957: 
                    958:    <pre>&lt;nav&gt;&lt;iframe seamless src="nav.include.html"&gt;&lt;/iframe&gt;&lt;/nav&gt;</pre>
                    959: 
1.230     mike      960:   </div>
                    961: 
1.338     sruby     962:   <p class="note">The <code title="attr-contenteditable"><a href="textFieldSelection.html#attr-contenteditable">contenteditable</a></code> attribute does
1.334     sruby     963:   not propagate into <code title="attr-iframe-seamless"><a href="#attr-iframe-seamless">seamless</a></code>
                    964:   <code><a href="#the-iframe-element">iframe</a></code>s.</p>
1.230     mike      965: 
                    966:   <hr><p>The <code><a href="#the-iframe-element">iframe</a></code> element supports <a href="dimension-attributes.html#dimension-attributes">dimension
1.1       mike      967:   attributes</a> for cases where the embedded content has specific
1.230     mike      968:   dimensions (e.g. ad units have well-defined dimensions).</p>
                    969: 
                    970:   <p>An <code><a href="#the-iframe-element">iframe</a></code> element never has <a href="content-models.html#fallback-content">fallback
1.338     sruby     971:   content</a>, as it will always create a nested <a href="textFieldSelection.html#browsing-context">browsing
1.1       mike      972:   context</a>, regardless of whether the specified initial contents
1.230     mike      973:   are successfully used.</p>
                    974: 
                    975:   <p>Descendants of <code><a href="#the-iframe-element">iframe</a></code> elements represent
1.1       mike      976:   nothing. (In legacy user agents that do not support
                    977:   <code><a href="#the-iframe-element">iframe</a></code> elements, the contents would be parsed as markup
1.230     mike      978:   that could act as fallback content.)</p>
                    979: 
                    980:   <p id="iframe-content-model">When used in <a href="infrastructure.html#html-documents">HTML
1.18      mike      981:   documents</a>, the allowed content model of <code><a href="#the-iframe-element">iframe</a></code>
1.338     sruby     982:   elements is text, except that invoking the <a href="textFieldSelection.html#html-fragment-parsing-algorithm">HTML fragment
1.18      mike      983:   parsing algorithm</a> with the <code><a href="#the-iframe-element">iframe</a></code> element as the
1.338     sruby     984:   <var title="concept-frag-parse-context"><a href="textFieldSelection.html#concept-frag-parse-context">context</a></var> element and
1.48      mike      985:   the text contents as the <var title="">input</var> must result in a
1.304     sruby     986:   list of nodes that are all <a href="content-models.html#phrasing-content-1">phrasing content</a>, with no
1.338     sruby     987:   <a href="textFieldSelection.html#parse-error" title="parse error">parse errors</a> having occurred, with
1.146     mike      988:   no <code><a href="the-script-element.html#the-script-element">script</a></code> elements being anywhere in the list or as
1.18      mike      989:   descendants of elements in the list, and with all the elements in
                    990:   the list (including their descendants) being themselves
1.230     mike      991:   conforming.</p>
                    992: 
                    993:   <p>The <code><a href="#the-iframe-element">iframe</a></code> element must be empty in <a href="infrastructure.html#xml-documents">XML
                    994:   documents</a>.</p>
                    995: 
1.338     sruby     996:   <p class="note">The <a href="textFieldSelection.html#html-parser">HTML parser</a> treats markup inside
1.230     mike      997:   <code><a href="#the-iframe-element">iframe</a></code> elements as text.</p>
                    998: 
                    999:   <div class="impl">
1.1       mike     1000: 
                   1001:   <p>The IDL attributes <dfn id="dom-iframe-src" title="dom-iframe-src"><code>src</code></dfn>, <dfn id="dom-iframe-srcdoc" title="dom-iframe-srcdoc"><code>srcdoc</code></dfn>, <dfn id="dom-iframe-name" title="dom-iframe-name"><code>name</code></dfn>, <dfn id="dom-iframe-sandbox" title="dom-iframe-sandbox"><code>sandbox</code></dfn>, and <dfn id="dom-iframe-seamless" title="dom-iframe-seamless"><code>seamless</code></dfn> must
                   1002:   <a href="common-dom-interfaces.html#reflect">reflect</a> the respective content attributes of the same
                   1003:   name.</p>
                   1004: 
                   1005:   <p>The <dfn id="dom-iframe-contentdocument" title="dom-iframe-contentDocument"><code>contentDocument</code></dfn>
1.145     mike     1006:   IDL attribute must return the <code><a href="dom.html#document">Document</a></code> object of the
1.338     sruby    1007:   <a href="textFieldSelection.html#active-document">active document</a> of the <code><a href="#the-iframe-element">iframe</a></code> element's
                   1008:   <a href="textFieldSelection.html#nested-browsing-context">nested browsing context</a>, if any, or null otherwise.</p>
1.1       mike     1009: 
                   1010:   <p>The <dfn id="dom-iframe-contentwindow" title="dom-iframe-contentWindow"><code>contentWindow</code></dfn>
1.338     sruby    1011:   IDL attribute must return the <code><a href="textFieldSelection.html#windowproxy">WindowProxy</a></code> object of the
                   1012:   <code><a href="#the-iframe-element">iframe</a></code> element's <a href="textFieldSelection.html#nested-browsing-context">nested browsing
1.204     mike     1013:   context</a>, if any, or null otherwise.</p>
1.1       mike     1014: 
1.230     mike     1015:   </div>
                   1016: 
                   1017:   <div class="example">
1.1       mike     1018: 
                   1019:    <p>Here is an example of a page using an <code><a href="#the-iframe-element">iframe</a></code> to
                   1020:    include advertising from an advertising broker:</p>
                   1021: 
                   1022:    <pre>&lt;iframe src="http://ads.example.com/?customerid=923513721&amp;amp;format=banner"
                   1023:         width="468" height="60"&gt;&lt;/iframe&gt;</pre>
                   1024: 
1.230     mike     1025:   </div>
                   1026: 
                   1027: 
                   1028: 
                   1029: 
                   1030:   </body></html>

Webmaster