-1

I am looking for a Jquery variable that identifies the source url from which a page has been opened. The aim is to do a code like this: If you access page A from page B, then… / If you access page A from page C, then…

(note: I don't use php)

Thanks,

Jan
  • 5
  • 1

1 Answers1

0

With window.location.href; you get the full URL (https://test.com/itm/012458.html) With window.location.origin; you get the base URL https://test.com And with window.location.pathname; the path only (/itm/012458.html) Sorry, I think I misunderstand you. You need as another user wrote: var x = document.referrer;

Meziane
  • 1,586
  • 1
  • 12
  • 22
  • 1
    It's indeed document.referrer I need, thank you. – Jan Apr 16 '19 at 12:02
  • It will be nice if you accept ma answer. – Meziane Apr 16 '19 at 12:09
  • Thank you very much Julie. Please don't let you discourage with the '-1'. You are welcome to stackoverflow: every one at the community will do his/her best to help each other, especially new user. So please don't hesitate to ask your questions. Thank you again and Bon courage Julie! – Meziane Apr 16 '19 at 13:19