I have a single-page ajax powered web app, however the way my app works is if a hash开发者_JAVA技巧 string is in the url it will load that element which is really useful for people to link to content on it.
When it comes to bookmarking/favouriting things are different. My users want to book mark the app and not the current bit of content (hash string) they're on...
I'm thinking this is unlikely but is there anyway to get browsers to not include the hash string when the page is bookmarked?
I'm going with you are using the hash as an anchor, rather than a way to store a page's state in a Ajax application.
There are a few solutions you can implement:
Don't use anchors (and thus don't use a hash) and thus hash won't be bookmarked. Instead you can use something like jQuery ScrollTo and scroll to the link instead using javascript instead of the built-in anchor support. http://demos.flesler.com/jquery/scrollTo/
Have a toolbar up the top which contains the url without the hash, or a sidebar.
Educate your users.
If you are asking about keeping support for anchors in Ajax Web 2.0 Applications, then you may want to look at jQuery Ajaxy as it supports this; as seen by the "Durian" demo: http://www.balupton.com/sandbox/jquery-ajaxy/demo/
精彩评论