<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>防止网站外部调用js,php方法</title>
</head>
这是一段简单的防止网站被iframe调用的js方法
<script>
if (top.location != self.location)top.location=self.location;
var isindex=1;
</script>
下面一段php
<?php
$url = 'www.111cn.net';
if( $_SERVER['HTTP_HOST'] <> $url )
{
header("location:http://www.111cn.net");
}
?>
<body>
</body>
</html>
时间: 2024-10-25 23:03:30