This demo uses the browser's Audio API to determine the tempo of a song, processing a chunk of 30 seconds of a song.
For more information, read the blog post Beat Detection Using JavaScript and the Web Audio API, from where I've taken the code to perform the track analysis, and my blog post where I explain some changes I made to the original algorithm and how I used Spotify's APIs to find and match tracks.
How this works: