防止网页被嵌入框架

来源:互联网 发布:东东手游助手 mac 编辑:程序博客网 时间:2024/05/16 09:52

1.防止网页被嵌入框架

<script type="text/javascript">try{  top.location.hostname; // 跨域报错,IE,火狐有效  if (top.location.hostname != window.location.hostname) { // 对chrome的判断    top.location.href =window.location.href;  }}catch(e){  top.location.href = window.location.href; // 从定位}</script>




原创粉丝点击