5 examples of 'window location hash' in JavaScript

Every line of 'window location hash' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
12function getWindowHash() {
13 let hash = window.location.hash.replace(/^#\/?|\/$/g, '');
14
15 //Do not include state
16 hash = hash.split(URL_STATE_DELIM)[0];
17
18 //console.log('hash:', hash);
19 return hash;
20}
67function _getWindowHash(){
68 //parsed full URL instead of getting location.hash because Firefox decode hash value (and all the other browsers don't)
69 //also because of IE8 bug with hash query in local file [issue #6]
70 var result = _hashValRegexp.exec( hasher.getURL() );
71 return (result && result[1])? decodeURIComponent(result[1]) : '';
72}
89get hash(): string {
90 if (this._location === null) {
91 return null;
92 }
93
94 return this._location.hash;
95}
37get hash(): string {
38 return this.appLocation.hash;
39}
34get hash() { return this._location.hash; }

Related snippets