Take the 2-minute tour ×
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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()

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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