1

I want to play an animation when you are not redirected from my page (when you have not clicked a link on My page and got redirected to another page on My page) much like: animade.tv

It there any way to detect that with javascript? If not, can you do it with php?

Kinlan
  • 16,315
  • 5
  • 56
  • 88
DayDun
  • 59
  • 1
  • 9
  • 1
    What exactly do you mean by "redirected?" – Matt Ball Nov 26 '15 at 16:44
  • Pick which one you want and then google it. There are so many examples. [Here is a PHP one](http://stackoverflow.com/questions/2313834/how-to-detect-the-site-a-user-came-from-before-mine-in-php), and [Here is a JS one](http://stackoverflow.com/questions/3420031/how-do-i-get-the-referrers-domain-host-name-using-javascript) – musefan Nov 26 '15 at 16:46

2 Answers2

4

You can use both js or php

js: document.referrer

php: $_SERVER['HTTP_REFERER']

sometimes it could be empty, you can just verify that is different from your domain

Gumma Mocciaro
  • 1,205
  • 10
  • 24
1

use document.referrer to test the url

Ramanlfc
  • 8,283
  • 1
  • 18
  • 24