2

I am using Rails with a SPA (React). When trying to get the full path, I cannot seem to be able to get the entire path after the domain. It always truncates everything after the hash:

url: http://localhost:3000/r?locale=en#/site-personalization

request.fullpath returns:

/r?locale=en

request.path returns:

/r

What method can I use to get everything including the #/site-personalization portion of the URL?

I'm hoping that "Get anchor part of URL in controller in Ruby on Rails" is not the same problem as what I'm facing.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Adrian E
  • 1,884
  • 3
  • 21
  • 33

1 Answers1

2

Anchors are not being sent to the server so that's why you cannot get them.

Kamil Gwóźdź
  • 777
  • 5
  • 11
  • I was afraid of that... any suggestions to accomplish what I want? Any suggestions on how to accomplish what I want without using React/Cookies? – Adrian E Jan 20 '20 at 20:16
  • Would URL encoding the # to %23 work for you? So the URL would be http://localhost:3000/r?locale=en%23/site-personalization – jessebs Jan 21 '20 at 22:08