iframe

作者: 感光狗 | 来源:发表于2019-07-18 17:05 被阅读0次

iframe 元素会创建包含另外一个文档的内联框架(即行内框架)。

自适应 iframe

默认情况下,iframe会自带滚动条,不会全屏,如果你想自适应 iframe 的话:去掉滚动条

<iframe src="./iframe.html" id="iframe1" scrolling="no"></iframe>

防嵌套网页

使用iframe来拦截click事件。因为iframe享有着click的最优先权,当有人在伪造的主页中进行点击的话,如果点在iframe上,则会默认是在操作iframe的页面。通过诱导用户进行点击。
使用window.top来防止网页被别的网站嵌入

if( window != window.top ){
  widnow.top.location.href = correntURL
}

通过host来判断

try{
  top.location.hostname;
  if( top.location.hostname != window.location.hostname ){
    top.location.href = window.location.href
  }
}
catch( e ){
  top.location.href = window.location.href;
}

参考

https://www.cnblogs.com/hq233/p/9849939.html

相关文章

  • HTML常用标签的介绍

    iframe a form input select textarea table iframe iframe单独...

  • HTML常用标签的笔记整理

    iframe a form input select textarea table iframe iframe单独...

  • HTML常用标签iframe、a、form、input、tabl

    本文所介绍的标签:iframe、a、form、input、table iframe 标签 嵌套页面 iframe ...

  • H5在ios中使用iframe滚动失效问题

    iframe设置了高度(例如500px)。倘若iframe的内容超出了iframe设定的高度时。iframe内部h...

  • jQuery-iframe加载完成后触发的事件监听

    获取iframe变量 :iframe.contentWindow. variate

  • 网页局部打印功能

    思路: 将打印内容写入到iframe中,通过iframe的window对象print()方法实现iframe打印 ...

  • iframe

    iframe 用于在网页内显示网页。 添加iframe语法 URL 指向隔离页面的位置。 Iframe - 设置高...

  • Iframe内嵌框架

    1.