1

On my home page I like for it to open up only if it was forwarded from a certain URL.

For example, www.xyz.com/fillform forwards to www.abc.com

on www.abc.com I like to see if I was forwarded from www.xyz.com/fillform If so, I not, I would like to forward them to www.xyz.com/fillform.

If they were, then the page would open. Is this possible through jQuery?

Cullub
  • 2,901
  • 3
  • 30
  • 47
Nate Pet
  • 44,246
  • 124
  • 269
  • 414

1 Answers1

0

As others have mentioned, and as explained in this answer, this is NOT a secure option and should not be used to protect any kind of sensitive content.

But, to answer the question, it IS technically possible using jQuery:

if (document.referrer === "http://www.example.com/mypage1.html") {
    // Do something
    alert('Referred from expected page. Probably.');
}

If you have the option, this kind of thing can be done very reliably on the server side (PHP, etc.)

Community
  • 1
  • 1
Benjamin Ray
  • 1,855
  • 1
  • 14
  • 32