2

I'm trying to get the previous URL in chrome via document.referrer but this is not working in IE.

Sunil Kashyap
  • 2,946
  • 2
  • 15
  • 31
  • Possible duplicate of [How to get the previous URL in JavaScript?](https://stackoverflow.com/questions/3528324/how-to-get-the-previous-url-in-javascript) – Venkatesh Manohar Apr 25 '19 at 12:29
  • @VenkateshManohar I already checked the link and it did not resolve my issue, my question is how to make work document.referrer in IE browsers – Sunil Kashyap Apr 25 '19 at 12:33
  • In that case you have to clearly mention what all options have you tried and how exactly are you trying to use document.referrer. – Venkatesh Manohar Apr 25 '19 at 13:01
  • 1
    Can't reproduce the problem on my side, I have tried to create a sample and using the document.referrer property to get the URI of the page that "linked" to this page in the page load method, it seems that everything works well in IE 10+, I could get the url. Can you share the related code? or try to use F12 developer tools to check whether it contains some error? – Zhi Lv Apr 26 '19 at 08:14
  • @ZhiLv-MSFT thanks for the efforts, actually it was an issue at my end, the browser is returning null every time, but after restarting pc it's working, don't know how but it's working. – Sunil Kashyap Apr 26 '19 at 08:55

2 Answers2

2

document.referrer is working on IE10+ and edge browsers, this issue is only at my side, the browser was returning null every time but after restarting pc everything works perfectly.

Sunil Kashyap
  • 2,946
  • 2
  • 15
  • 31
1

document.referrer works on IE9+ so you can use this to get history url.

skamla
  • 30
  • 6