admin管理员组

文章数量:1195563

how i can make my pages show like grooveshark pages
!/popular
is there a tutorial or something to know how to do this way for showing page by jQuery or JavaScript?

how i can make my pages show like grooveshark pages
http://grooveshark.com/#!/popular
is there a tutorial or something to know how to do this way for showing page by jQuery or JavaScript?

Share Improve this question asked Oct 13, 2012 at 8:05 Déjà BondDéjà Bond 3014 gold badges9 silver badges32 bronze badges 1
  • 1 I added some tips to my answer that you may find useful if you want to create a site using this technique. – bigblind Commented Oct 13, 2012 at 8:27
Add a comment  | 

1 Answer 1

Reset to default 28

The hash and exclamation mark in a url are called a hashbang, and are usualy used in web applications where javascript is responsible for actually loading the page. Content after the hash is never sent to the server. So for example if you have the url example.com/#!recipes/bread. In this case, the page at example.com would be fetched from the server, this could contain a piece of javascript. This script can then read from location.hash, and load the page at /recipes/bread.

Google also recognizes this URL scheme as an AJAX url, and will try to fetch the content from the server, as it would be rendered by your javascript. If you're planning to make a site using this technique, take a look at google's AJAX crawling documentation for webmasters. Also keep in mind that you should not rely on javascript being enabled, as Gawker learned the hard way.

The hashbang is being going out of use in a lot of sites, evenif javascript does the routing. This is possible because all major browsers support the history API. To do this, they make every path on the site return the same Javascript, which then looks at the actual url to load in content. When the user clicks a link, Javascript intercepts the click event, and uses the History API to push a new page onto the browser history, and then loads the new content.

本文标签: javascript hashtag and exclamation mark in links as folderStack Overflow