Having an HTML5 MP3 player persist across page loads

Go To StackoverFlow.com

0

So I've been doing a little research on the different methods to achieve having a player (or any element for that matter) persist across page loads like this and it seems like there are two options. Both of which I will be creating my site to harness AJAX loads:

  1. Hash bang - This seems to have a lot of hatred across the web but should work in all browsers as of right now. It also seems to be very easy to implement.

  2. HTML5 History - From what I've read this is the "proper" way to do this, however, it has very limited browser support at this point. For browser that aren't supported full page refreshes will occur (History.js).

So my question is: Is there a third option? Or can someone please weigh in on the above two? It seems like HTML5 History is "better" but if I need the site to work correctly in all browsers then Hash bang is my only option. Is this true?

2012-04-05 16:49
by Andrew.S


0

Use history and onpopstate as the first option, but when that fails, set the hash bangs. Then make sure that your routing can handle both the hash bangs and the pretty onpopstate URLs, so that users can follow either bookmark.

I've used this configuration once myself, and it wasn't a whole lot of JavaScript. It was annoying to get it all right, but it was doable and worth the effort to deliver the best experience in all browsers.

I'd love to hear a second opinion on this if there's a better solution.

2012-04-05 17:04
by Espilon
Ads