代码之家  ›  专栏  ›  技术社区  ›  Gandalf StormCrow

javascript中的头位置

  •  2
  • Gandalf StormCrow  · 技术社区  · 15 年前

    如果访问者来自index html alert,是否可以像在php头位置那样使用javascript?如何?谢谢您

    2 回复  |  直到 15 年前
        1
  •  2
  •   Bella    15 年前
    if(document.referrer == url){ alert(msg); }
    

    应该这样做。

        2
  •  2
  •   Alan Christopher Thomas    15 年前

    检查引用,但您很可能需要绝对URI,如下所示:

    if (document.referrer == 'http://domain.com/index.html')
        alert('How was the index?');