<?php
//示例1html页面禁止被框架调用
header(‘X-Frame-Options: deny’);
//示例2只允许页面被本站调用
header(‘X-Frame-Options: SAMEORIGIN’);
//示例3只允许页面被指定URL嵌套调用
header(‘X-Frame-Options: http://www.feiniaomy.com’);
?>
<script>
if (self == top) { window.open(“index.html”, “_self”); } //如果在框架外部打开则跳转回主页
</script>
<script>
if (self != top) { window.open(“index.html”, “_self”); } //如果在框架内打开的就执行跳转
</script>
<script>
if (self != top) && (location.host.indexOf(“uphong.cn”)>0) { window.open(“index.html”, “_self”); } //只允许页面被指定URL嵌套调用
</script>