"You probably know that using # in a URL allows you to create links that are unique to particular content on the page. For example, this blog post has no fewer than four different hash-based links pointing at it."
Hash (or URL fragment identifier) is trivially easy to implement (e.g. ). URLs with hashes can be used for navigation (e.g. Moz's blog posts use the hash to navigate you to a particular comment, like this one from my wife). Hashes can also be used like tracking parameters (e.g. randswhisky .# = twitter). Using URL hashes for something other than these, such as showing unique content than what's available on the page without the hash or wholly separate pages is generally a bad idea.
"If you're sending users to one specific spot on your page, then using hashes might be helpful. For example, I had another article where I wanted readers to go directly to my response in comments: randswhisky.com/comments/#comment-9654485 . However, this isn't always useful and could actually hurt your experience."
There are many things that cause problems when using custom URLs with hashtags: They can fail silently (e.g. clickjacking ) or not at all (e.g undefined window scroll position ). Performance issues arise since browsers may request contents of new pages even if they are not visible or not even on the screen.
If there is something unique to be displayed (rather than links to navigate you elsewhere) then hashes probably shouldn't be used. URL hashes are also an easy way for hackers and others to exploit your website's content.
Links containing hashes load contents in very different ways than standard links so it's really hard to know what will happen until you see it with your own eyes. So, I'd encourage you to use this power for good and avoid creating any unnecessary #hash-driven "unique content" on your page. The best use of the hash sign in the URL is that which helps users find their way back home.
Article summary: Use URL hashes only if you want to navigate users elsewhere on your website or external websites, rather than show unique content on your page. If there is something unique to be displayed (rather than links to navigate you elsewhere) then hashes probably shouldn't be used. Hashes are also an easy way for hackers and others to exploit your website's content. The best use of the hash sign in the URL is that which helps users find their way back home.. Article author: Vatsal Dani , Moz's writer, living in Mumbai,
"Moz, you should update your blog post hrefs to use #. I've noticed that many sites link directly to the comments section at the bottom of a page, and these links can break if someone adds or removes content before it. It's much better to link directly to where the observer is located within that particular article."
"So, if people link directly to that comments section with a hash in the url (e.g. randswhisky/comments/#comment-9654485), then it will break when it changes locations (which happens frequently). I've seen many commenters complain about the comment section not showing up and even sent two of my own posts there to make sure they weren't broken for others."
#This is common knowledge...so don't create hashes as a way to navigate users between different pieces of content. #Just link directly to where the observer is located within that particular page, like we do in the Moz blog posts. --URLs with hashes create separate/unique content (for example: randswhisky.com/lagavulin#src=twitter). Common knowledge: Take down your website and redirect it if need be, just remove all those #'s from the URLs before uploading new files again. "It's much better to link directly to where the observer
Top Blog Posts
- Learn HTML in 12 Minutes 3 months ago
- FOCUS ON YOURSELF NOT OTHERS - Best Motivational Speech 2021 4 months ago
- British English Slang [Advanced Pronunciation Practice] - Reductions & Contractions 4 months ago
- How To Build Your URL Short System (Premium URL Shortening Setup) 4 months ago
- Improve Your Problem Solving Skills 4 months ago