Lea Verou 5/23/2011

Get your hash — the bulletproof way

Read Original

This article explains the proper way to extract the hash value from `window.location.hash` in JavaScript. It critiques common but fragile code snippets, highlights issues with unicode characters and empty hashes, and recommends using `location.hash.substring(1)` or `slice(1)` for a robust solution.

Get your hash — the bulletproof way

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
ServiceNow and Microsoft Copilot
Marius Sandbu 1 votes
2
The Learning Loop and LLMs
Martin Fowler 1 votes