0

I'v paid attention to google's

 https://mail.google.com/mail/?shva=1#inbox

Particularly to #inbox

This URL can be bookmarked, how this can be achieved?

Jevgeni Smirnov
  • 3,787
  • 5
  • 33
  • 50
  • 1
    possible duplicate of [How does github change URL without reloading a page?](http://stackoverflow.com/questions/7591087/how-does-github-change-url-without-reloading-a-page) – Quentin May 03 '12 at 13:47
  • The page at https://mail.google.com/mail/ simply checks the hash tag with JavaScript once it loads and then asynchronously modifies the page to show the "Inbox" content. It's not *quite* as simple as that, as they employ other mechanisms to not break the back button and to keep history. – Cᴏʀʏ May 03 '12 at 13:48

1 Answers1

1

Because it is being processed by Javascript via Ajax calls, that take in consideration what is inside the query string.

An example for locating in Javascript all # tags is:

urlquery=location.href.split("#");

So when first loading a page that contains that kind of links, the links on the page are generated containing # anchors that, when clicked, change the location address, but doesn't cause the page to reload, as it is an anchor to the current page. Then javascript hooks to the click event do the real job of loading the real content via Ajax.

But, since the address has changed on the location bar, you can store it on a bookmark. When that bookmark is loaded, it loads a barebone web with javascript to detect again which tags are on the address with #, and then load via Ajax the real content.

That's why, for example, the thumbnail of Twitter page on Google Chrome always shows an interface without messages, because when that thumbnail is generated, the Ajax still has not loaded the content.

vicenteherrera
  • 1,442
  • 17
  • 20