[ACCEPTED]-Get anchor part of URL in controller in Ruby on Rails-anchor
Accepted answer
You can't do that in Rails, because the 1 anchor is not sent to the server. See mikeduncan.com/?s=named+anchors
No sorry, it's not possible to retrieve 6 the #anchor from the server-side (in any 5 language).
This is a client-side flag to 4 tell the browser to move to a specific position 3 in the page.
But you can use some Javascript 2 in the body to check for an anchor and send 1 it back to the server using an Ajax-call...
var anchor_value;
var stripped_url = document.location.toString().split("#");
if (stripped_url.length > 1)
anchor_value = stripped_url[1];
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.