Ajax # and scroll-to #
Is it possible to have both an "AJAX" hash mark #
as well开发者_StackOverflow as a scroll down to one?
Thanks.
No.
The
#
is a special character in a URL, it marks the rest of the URL as a fragment identifier, so everything after it refers to an HTML element id, or a named anchor in the current page. (Source)
What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for? - it's only for Googlebot.
Yes.
If you really want to have both, the scroll-to bit can be fudged width JavaScript. It wouldn't be pretty.
As far as I know, # is not allowed in a fragment identifier. You could encode it as %23 and do something with that maybe.
If you're doing on-page stuff that you would like to be able to scroll to, you could just hijack links by adding a certain class to them or something.
Also, consider reading up on history.pushState and such on:
https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
精彩评论