<p>This isn't possible because the <code>#hash</code>-part isn't even send to the server. See this question on StackOverflow: <a href="https://stackoverflow.com/q/940905/3589841">Can PHP read the hash portion of the URL?</a></p>

<p>But if you use <code>?hash=something</code> instead, these functions will help you: <a href="http://buildwithcraft.com/docs/templating/craft.request#getParam" rel="nofollow noreferrer"><code>getParam()</code></a> and <a href="http://buildwithcraft.com/docs/templating/craft.request#getQuery" rel="nofollow noreferrer"><code>getQuery()</code></a></p>

CC BY-SA 3.0
2014-08-04T19:00:18.367Z
2014-08-04T19:00:18.367Z
2017-05-23T12:38:53.957Z
Victor
<p>Is there a method or recommended way of grabbing URL hash parameters with Twig? </p>

<p>For example, if my URL is <a href="http://mysite.com/my-page#hash" rel="noreferrer">http://mysite.com/my-page#hash</a>, is there a way to grab the hash?</p>

<templating><url>
Method to grab URL hash in Twig or craft.request?
# Method to grab URL hash in Twig or craft.request?

(Asked by: username_0 on 2014-08-04)

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?

**Tags:** templating, url


---

## 1 answers

### Answer by username_1 on 2014-08-04. Score: 8 | Accepted answer

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?](https://stackoverflow.com/q/940905/3589841)

But if you use `?hash=something` instead, these functions will help you: [`getParam()`](http://buildwithcraft.com/docs/templating/craft.request#getParam) and [`getQuery()`](http://buildwithcraft.com/docs/templating/craft.request#getQuery)


---

