0


I am not very experienced with Javascript and i have implement simple redirection with Javascript but now i want to get URL (previous) when the user will press browser back button after that redirection.
I am trying to get previous URL with "document.referrer" but it is not returning correct previous url.
I am redirecting my web page with this.

window.open('https://weather.com');

But after this redirection when the user will press browser back button, i want to get back this url from my own web page because i want to track that URL and implement some more functionality.
I ll need help to complete this process and i will really appreciate your help. Thank you!!

wplearner
  • 405
  • 6
  • 19
  • I guess you are confusing jQuery and javascript, jQuery is just a javascript-library. Your question is about javascript functionality. Please edit your question with javascript-tag and remove jQuery tag. Also corect the text. – Esko Jun 02 '17 at 12:02
  • Thank you for your immediate response. I appreciate it. I know JQuery is javascript library but now i am trying to get back that url after redirection. We can get that from browser history or from cookies but i am not sure so if you will guide me about this that will be very much helpful for me to complete this process. Thanks again. – wplearner Jun 02 '17 at 12:05
  • 2
    Possible duplicate of [How do you get the previous url in Javascript?](https://stackoverflow.com/questions/3528324/how-do-you-get-the-previous-url-in-javascript) – Alexander Jun 02 '17 at 12:09
  • Without [mcve] it is unlikely we can help you. We need to see the problem, the code you provided does not showcase anything. – Esko Jun 02 '17 at 12:09
  • if you are working in same domain, you can save address into localstorage/session storage and keep you own history – xszaboj Jun 02 '17 at 12:14
  • Thanks all of you for your response and time. I am redirecting my web page with Java script and after that redirection when the user will press browser back button then i want to get back previous url as i have mentioned above in my question. Right now i am thinking to use cookies for this purpose. – wplearner Jun 02 '17 at 12:15
  • I am not redirecting my page to same domain. That will be an external url. – wplearner Jun 02 '17 at 12:16

0 Answers0