0

I has current problem: urlA = "https://somethingA.me?someParams=somevalue123" urlB = "https://somethingB.com"

When I access the urlA I am instantly redirected to the urlB. How do I do to get the origin URL? (the urlB) When I try to use window.history there is nothing, document.referrer nothing too. In-network tab of the browser in the document request type I can see the request made to urlA and redirect with 301 response. There's any way to get the origin URL? Please, any tips?

Marin
  • 141
  • 4
  • 13
  • You probably need to add more context. Is there some reason you can't store the window.location into local storage or something? – Joshua Wood Jul 06 '22 at 22:57
  • For me the question seems to be failing the use-case that you are trying to cover for. In which scenarios do you need to track if your target url has a redirect on it? – Icepickle Jul 06 '22 at 22:58
  • The response headers of the 301 should have a Location property containing urlB. – James Jul 06 '22 at 23:09
  • Yes, I can not set window.location in the urlA because I has no access to it. My only access is to the code on the urlB. The user will access the urlA with some parameters, but when the server get this call it instantly redirect to the urlB (301 status response) and when it do it, I don't get any information of the origin (the urlA), but if I open my network tab in browser, I can see the url origin in the request type document, know? maybe if has some way to get the requests that my current url made, or something like that? i don't know how solve this :/ – Marin Jul 07 '22 at 01:29
  • @James, yes, the response headers of the 301 has the urlA, but the problem is: how I can access this information from my urlB via javascript? get info of a request that my browser did, do you know how? – Marin Jul 07 '22 at 01:31
  • If you're just sending the request to urlA from the browser by typing it in, yeah you won't have access to the response headers. I thought maybe you were sending another type of request, ajax for example. – James Jul 07 '22 at 05:01

0 Answers0