1

I have three pages
1.index.html
2.navigate.html
3.lastpage.html

Index.html

<a href="lastpage.html">lastpage</a>

Navigate.html

<a href="lastpage.html">lastpage</a>

I need to get the page name in Lastpage.html from which page it is redirected in javascript or jquery.

KarthikManoharan
  • 805
  • 5
  • 12

3 Answers3

2

You're looking for document.referrer

Jamiec
  • 133,658
  • 13
  • 134
  • 193
1

You can try

<a href="lastpage.html?page=navigate">lastpage</a>

And check query in JS - How can I get query string values in JavaScript?

Community
  • 1
  • 1
Nick
  • 1,530
  • 2
  • 15
  • 22
0

Beyond other answers, you can always store some values (like source URL) in local storage (per session, or per client), sessionStorage.setItem("source", "b.html");.

IProblemFactory
  • 9,551
  • 8
  • 50
  • 66