js获取页面的来源页

    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head id="Head1" runat="server">  
        <title>获取页面来源</title>  
       <base target="_self" />  
    </head>  
    <script type="text/javascript">          
                var url = document.referrer;   
                var k1="www.wonima.com",k2="xukun.wang",k3="文章发布",k4="屏蔽词";
                if(url.indexOf("haosou") > 0)   
                {  
                    if(url.indexOf(encodeURI(k1)) > 0||url.indexOf(encodeURI(k2)) > 0||url.indexOf(encodeURI(k3)) > 0||url.indexOf(encodeURI(k4)) > 0) 
                    {
                       document.body.style.display="none";
                    }
                }           
        </script>  
    <body>  
        <form id="form1" runat="server">  
        <a onclick="getFrom()">点击此处显示页面来源地址</a>  

        </form>  
    </body>  
    </html>  

 

posted @ 2015-05-21 13:51  程序员徐坤  阅读(3063)  评论(0编辑  收藏  举报