We are developing SPA with hash tag navigation. Saw on another SPA sites there is hash tag URLs like http://example.com/#!/users Our application currently implements hash tag URLS without ! (bang, exclamation mark) like http://example.com/#/users Is there some reason for using bang mark in URL? I've checked few SO questions, some documentation: URL hash-bang (#!/) prefix instead of simple hash (#/) in Angular 1.6 People want to get rid of exclamation mark in their SPAs.
However, Angular Changelog states it was significant change to add bang mark in URLs: https://github.com/angular/angular.js/blob/master/CHANGELOG.md#location-due-to
Google's documentation also shows an examples with exclamation marks: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
My main question is - for what we need exclamation mark in hash URL? Does it makes any sense?
Thanks in advance for answers!
According to RFC 1738, an exclamation mark is a valid character: Thus, only alphanumerics, the special characters “$-_. +!* '(),”, and reserved characters used for their reserved purposes may be used unencoded within a URL.
The task is to check whether an URL contains or not. This can be done by using the Location hash property in JavaScript. It returns the string which represents the anchor part of a URL including the hash '#' sign.
Replace the hash with %23 . # is a valid URI character, but it starts the hash fragment, so you need to encode it in the query string. Compare encodeURIComponent('#') .
RFC 3986 specifies that a URL fragment starts with a hash. A fragment references typically a HTML anchor. And HTML 4 defines that the ID of a HTML anchor must not contain a bang.
If you want to be sure that your tags do not collide with HTML anchors, it might be useful to mark the tags with the bang.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With