Gmail-like navigation [duplicate]
Possible Duplicate:
How to show Ajax requests in URL?
Like in Gmail, using PHP if we need to have similar functionality of navig开发者_运维百科ating to different internal links, how could we do it?
For example, from inbox, a specific email gets opened and when I click back button it takes me back to inbox. The addresses are https://mail.google.com/mail/?shva=1#inbox
and #inbox/something
for a specific email.
Gmail uses an IFRAME
to implement history/navigation. When you click some links, it adds a new location by setting dynamically iframe source. Browsers take this as a change in the address, and so add a new history item. You can then use pre/next buttons.
GWT implements similar functionality (on which Gmail is built). Do not implement this yourself, as many Javascript libraries already implement this for you. You can use this YUI or this jQuery plugins for instance.
There is actually nothing (unless server-side code) to be written in PHP. This kind of history management is totally handled by Javascript and client-side code.
In case you don't want your app javascript driven and rely on the serverside processing (php) you don't need to worry about the history because every link will actually open a new page which is automatically saved in your history by the browser.
Your links would then look something like:
- mail/inbox
- mail/single/2381
- mail/answer/2312
精彩评论