10

Is there a method or recommended way of grabbing URL hash parameters with Twig?

For example, if my URL is http://mysite.com/my-page#hash, is there a way to grab the hash?

1 Answer 1

8

This isn't possible because the #hash-part isn't even send to the server. See this question on StackOverflow: Can PHP read the hash portion of the URL?

But if you use ?hash=something instead, these functions will help you: getParam() and getQuery()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.