条件如下: 1、有两个网站,一个是:http://www.1.com/test1.html,另一个是:http://www.2.com/test2.asp 
在test1.html文件中用iframe包函了http://www.2.com/test2.asp这个文件。 
test1.html的文件内容如: 
<iframe src="http://www.2.com/test2.asp" width="500" height="500"> </iframe> 2、在浏览器的地址中输入http://www.1.com/test1.html,实际上就是看http://www.2.com/test2.asp的内容。因为test1.html包函了test2.asp 问题: 我在test2.asp中怎么样获取浏览器地址栏中的地址是不是http://www.1.com,也就是说是不是http://www.1.com/test1.html包函了他。 附: 
别告诉我用:Request.ServerVariables("SERVER_NAME")或Request.ServerVariables("URL").因为这样只能获到www.2.com

解决方案 »

  1.   

    Request.ServerVariables("HTTP_REFERER")或者你用JS提交到服务器端
      

  2.   

    比如:document.write('<iframe src="http://www.2.com/test2.asp?url='+location.href+'" width="500" height="500">  </iframe>');
      

  3.   

    上面的方法不行!
    因为我必须在test2.asp中处理。
    <iframe src="http://www.2.com/test2.asp?url='+location.href+'" width="500" height="500">  </iframe>如果是这样就没有任何意义!假如:
    我的域名是:http://www.我要偷你数据.com/偷你数据.html
    我在我的“偷你数据.html”文件中加上:
    <iframe src="http://www.2.com/test2.asp?url=www.1.com/1.html" width="500" height="500">  </iframe>那岂不是过关了?
    所以上面的答案不行。
      

  4.   

    直接用客户端脚本即可。
    http://www.2.com/test2.asp  
    ------------------------------ 
    <script> 
    alert(top.location) 
    if(top.location!=self.location)alert("页面被框架加载") 
    </script>
      

  5.   

    试试:
    <%= Request.ServerVariables("HTTP_REFERER")%>你可以前台加后台一起判断.