Implement github.com file without visible files

I just noticed a recent change when viewing github repositories. When you select a file or folder, the new file moves and pops out the old file. This is fairly easy to do with jquery, but it’s really different that the URL itself is really changing, so the bookmarks still work. I tried to create this for the book navigation site I’m working on, but could not update the URL without a full page refresh. Any ideas on how github does this?

+3
source share
2 answers

It uses the new HTML5 API history.pushState / history.replaceState for this (therefore it only works in modern browsers).

. https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries.

, ( #)

+4

, , HTML5 - (, , ).

W3C ( , ), . , .

, HTML5, . , , .

+1

Source: https://habr.com/ru/post/1786317/


All Articles