次のコンテンツを「htm」拡張子のファイルに保存すると、レンダリングされ、JavaScript アラートも表示されることに驚きました。
私は、ブラウザーが html ファイルをレンダリングするために少なくとも html と body タグを必ず必要とするという印象を受けました。
ブラウザがこれを行うのは正常ですか?また、これによりセキュリティ関連の問題が発生しますか?
<table width="100%" height="100%" border="1">
<tr>
<td style="margin:0 auto;">
<div style='color:red;height:100%;width:100%;margin:0 auto;text-align:center;border-width:1px;border-color:blue;border-style:solid;vertical-align:middle' id="div1">
Does this render in a Browser, since there are html, head and body tags?
<div id='div2' style='height"100%;width:100%;margin:0 auto;text-align:center;border-width:1px;border-color:green;border-style:solid;'>Hello! Will the browser show this?</div>
</div>
</td>
</tr>
</table>
<script type='text/javascript'> alert('showing without tags');</script>