zoukankan      html  css  js  c++  java
  • document.referrer

    只有当用户在上一个页面点击链接到达当前页面,document.referrer才会有值,当用户输入这一页的网址、通过response.redirect、用了ssl这些情况referrer都会为空。
         另外,其必须通过http协议使用。否则不能得到返回值,即值为空。
         可以借助这个属性来检查用户是否非法进入,如:
       <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
        </head>
    <script>
        var url=document.referrer;
        if(url=="")
        {
            alert("you can not link to  this page directly 你不能直接进入");
            setTimeout("window.location.href='body.html'",500);
           
        }else
        {
            document.write("yes<br>");
            document.write(url);
        }
    </script>
    </html>

  • 相关阅读:
    Codeforces Round #274 (Div. 2)
    codeforces 477C
    ZOJ 3822 Domination
    Codeforces Round #271 (Div. 2)
    进程
    线程
    udp和tcp特点 实现文件上传
    面向对象补1
    socket基本语法和粘包
    网络编程
  • 原文地址:https://www.cnblogs.com/0769fe/p/5227245.html
Copyright © 2011-2022 走看看