Could a page display diferrent content if the URL hash changes?

前端 未结 7 1894
名媛妹妹
名媛妹妹 2021-01-14 15:24

How could a page display different content based on the URL hash?

I\'m not talking about the browser scrolling down to display the anchored section, but something li

7条回答
  •  死守一世寂寞
    2021-01-14 16:02

    The answer for this question will be more or less the same as my answers for these questions:

    • How to show Ajax requests in URL?
    • How does Gmail handle back/forward in rich JavaScript?

    In summary, two projects that you'll probably want to look at which explain the whole hashchange process and using it with ajax are:

    • jQuery History (using hashes to manage your pages state and bind to changes to update your page).

    • jQuery Ajaxy (ajax extension for jQuery History, to allow for complete ajax websites while being completely unobtrusive and gracefully degradable).

提交回复
热议问题