开发者

url having #! How is it useful For example facebook has http://www.facebook.com/#!

开发者 https://www.devze.com 2023-02-07 20:22 出处:网络
I see some time url has #! combination. What is the purpose of that ? & How it is useful. Can somebody elobrate o开发者_运维技巧n that.After the hash mark (\"#\") it is expected the ID of some X/H

I see some time url has #! combination. What is the purpose of that ? & How it is useful. Can somebody elobrate o开发者_运维技巧n that.


After the hash mark ("#") it is expected the ID of some X/HTML element in the page that has to be highlighted or scrolled to by the user agent. Valid HTML ID attributes cannot contain "!", so it is more or less guaranteed that whatever follows "#" here will not match any element in the page.

This trick is used to have many different URLs to the same page, and let a javascript in the page alter it by interpreting what comes after "#", possibly via AJAX. This has faster load times than if the user had to visit different pages. Also, it is bookmark and back button friendly.


When you see #! understand that this site is using Ajax. When you click a link it doesn't refresh whole page.

Why do they use #! ? After that sign they put the path of the page. If you are using old version of browser that doesn't support Ajax well, the script opens the page without Ajax.


http://code.google.com/web/ajaxcrawling/docs/getting-started.html

It's basically conforming to Google's ajax url standard. There is no magic behind it, but google wants sites to have consistent url patterns for ajax-powered sites.

0

精彩评论

暂无评论...
验证码 换一张
取 消