防止网页被嵌入框架

 1     try{
 2 
 3       top.location.hostname;
 4 
 5       if (top.location.hostname != window.location.hostname) {
 6 
 7         top.location.href =window.location.href;
 8 
 9       }
10 
11     }
12 
13     catch(e){
14 
15       top.location.href = window.location.href;
16 
17     }
posted @ 2011-08-30 10:09  oneroom  阅读(232)  评论(0编辑  收藏  举报
让别人快乐是慈悲,让自己快乐是智慧!