Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep audio playing while navigating through pages?

I am making a website for my friends band. I would like to know if its possible (apart from using Ajax) to keep audio playing after clicking on a link to another page on the site?

I currently have it set up using Ajax to reload the content, but I am having a few issues with it, and I'd rather not deal with the bother unless I really have to.

If not possible, is there a way to minimise the disruption (pausing then playing again) while navigating? It would be possible for the new page to continue playing the track from where the last page stopped, but I would like to minimise the pause. Or, on this subject, is it possible to keep certain page elements loaded after changing the URL (without using # urls), like facebook does (as in, you click on it, but the banner never disappears during loading)

Thanks for any help :)

like image 222
SkinnyBill Avatar asked Mar 04 '12 13:03

SkinnyBill


2 Answers

Use Ajax to load content and History API’s pushState() to alter URL without page reload.

For consistent behavior across browsers, consider using a wrapper library like History.js.

like image 199
Marat Tanalin Avatar answered Nov 09 '22 17:11

Marat Tanalin


Sites like Facebook use JavaScript/AJAX for these kind of things. If you don't want to use it, you can use frames (not recommended). Divide the page in two frames: the player and the website itself. This way you can easily turn it off too, just open the site without frames.

Good luck!

like image 20
Wesley Avatar answered Nov 09 '22 17:11

Wesley