on your ka profile page, you have an accordion menu to the left, with links:
behold some options for aforementioned links:
#1 — something that we can laugh at now.
#2 — something that we will laugh at in x months.
ka.org/profile/marcia/vital-statistics/focus/last-month
option #1 has a path… and a hash fragment… that has another path… with url parameters… and some portion of that should probably be encoded. …more ellipses… .. . ….. …. …. .and navigating around your profile doesn’t necessarily update the address bar.
option #2 boasts improved url aesthetic/readability/rememberability. clicking on those links still does the right ajax-y thing to bring in the correct graph to the right without a full page reload, but *now* your address bar changes to reflect what you’re actually looking at. and isn’t that what you would expect?
wouldn’t you expect to be able to bookmark the page, or to copy/paste the link, or to control-click the link to open in a new tab, or to refresh the page a gazillion times and See What You Expected To See? hitting the back button takes you back to the thing you last saw, and isn’t that how history should work?
make links work, and make history work. or perish!
fortunately, it took surprisingly few lines of code to transition from #1 to #2, thanks to backbone. i just had to create a router, and let other people’s code do my job. in case you don’t believe how easy it was, i specified some routes like so:
and then i tell backbone to Make It So:
!!!
and the most beautiful thing is that it behaves nicely in internet explorer. since window.history.pushState doth not worketh there, backbone gracefully falls back to a path plus hash fragment like /profile/marcia#/vital-statistics/activity/last-month
this is just one of many interesting nuggets sitting in https://khanacademy.kilnhg.com/Repo/Website/Group/profiles, which will not see the light of production until the new year. more on what we’re cooking up in profiles later.
You can leave a response, or trackback from your own site.

