codespeed icon indicating copy to clipboard operation
codespeed copied to clipboard

Use History API instead of explicit permalink button

Open squiddy opened this issue 14 years ago • 0 comments

Disclaimer: I haven't checked yet whether jQuery Address also provides this feature.

Right now, the jQuery Address plugin is used to update the URL when the permalink is clicked. IMO this has some disadvantages:

  • change of URL triggers a (unnecessary) page reload
  • hashtag urls (as seen in the timeline view)

The History API allows to modify the browsing history, e.g. pushing new pages are replacing the current one. Some advantages:

  • no page reload
  • no (ugly) hashtag URLs

Using the API for codespeed we can:

  • Remove the permalink button (the URL will be updated on every single change)
  • Users can copy the URL anytime and get the same view again

Problems

Of course, browser support: http://caniuse.com/#search=history

Apparently no current version of IE supports the API. But it might be possible to fallback on the old behaviour, that is showing a permalink button for IE users.

https://github.com/balupton/history.js looks promising, History API for HTML5 Browsers with fallback to hashtag urls.

Demo

https://github.com/squiddy/codespeed/tree/history_demo Look at the comparison view and you'll (hopefully) see what I'm aiming for.

http://html5demos.com/history/

squiddy avatar Dec 18 '11 11:12 squiddy