HTML iframe 标签禁止跳转页面

iframe标签的属性:sandbox,启用一系列对 <iframe> 中内容的额外限制,有5个值:

<iframe name="son" src="index.html" width="100%" height="100%" scrolling="auto" security="restricted"    sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts">
  </iframe>

 

  • ""                                  // 应用以下所有的限制。
  • allow-forms                  允许表单提交。
  • allow-same-origin       //允许 iframe 内容被视为与包含文档有相同的来源。
  • allow-scripts                //允许脚本执行。
  • allow-top-navigation     //允许 iframe 内容从包含文档导航(加载)内容。
发布了8 篇原创文章 · 获赞 11 · 访问量 1328

猜你喜欢

转载自blog.csdn.net/web_start/article/details/103311713